RE: [SMARTY] Question about smarty, and if it can replace PHPLIB
| From: | Renaud Binse | Date: | Wed, 19 Feb 2003 14:27:14 +0000 |
| Subject: | RE: [SMARTY] Question about smarty, and if it can replace PHPLIB | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7874@lists.php.net to get a copy of this message | ||
It's possible too...
In the php file:
$smarty->assign('var1', 'xxx');
$smarty->assign('var2', 'yyy');
$smarty->assign('tpl', 'content.tpl');
$smarty->display('index.tpl');
In the template file (index.tpl):
<HTML CODE>
...
{include file=$tpl}
...
<HTML CODE>
var1 and var2 will be accessible in both templates, content.tpl and
index.tpl, with the tags {$var1} and {$var2}
Hope it helps ;o)
Renaud
-----Message d'origine-----
De : Tom Sommer [mailto:webmaster@tsn.dk]
Envoyé : mercredi 19 février 2003 15:16
À : smarty-general@lists.php.net
Objet : Re: [SMARTY] Question about smarty, and if it can replace PHPLIB
"Messju Mohr" <messju@lammfellpuschen.de> wrote in
news:20030219140741.GH1626@pharao.lammfellpuschen.de...
> definately :)
cool
> in short:
> $smarty->assign('CONTENT', $smarty->fetch('content.tpl'));
> $smarty->display('index.tpl');
I see, but! my question is this
Before I fetch the file, I will have to parse it, add vars etc. to it...
on ny _news.php_ now, I have
require_once('init.php'); // Loads the template and makes everything ready
to parse index.tpl
$template->set_file('news','news.tpl');
$template->set_var('NEWSITEM','this thing');
$template->set_var('CONTENT',$template->parse('news','news'));
// Lets display the entire site, based on index.tpl
$template->pparse('output','index'); // index is the alias for index.tpl
if you get my point...
--
Tom Sommer
www.tsn.dk - www.dreamcoder.dk
--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php