Re: Parsing one template into another
| From: | Anders Janson | Date: | Wed, 26 Sep 2001 09:50:09 +0000 |
| Subject: | Re: Parsing one template into another | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1552@lists.php.net to get a copy of this message | ||
Peter Bowyer wrote:
> At 08:30 AM 9/26/01 +0200, Hans-Peter Oeri wrote:
> >What exactly do you mean by "parsing one template into another"? You can
> >easily
> >include templates in templates - that's what the include function is for
> >(there
> >is a smarty include as well as a php include).
>
> Well, at the moment I'd have:
> ---
> <html>
> <head>
> <title>Site Design</title>
> <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1">
> </head>
> <body bgcolor="#FFFFFF">
> {CONTENT}
> </body>
> </html>
> ----
>
> and then for each page I'd have something like:
> ----
> <p> This would be content but this is a dummy. Your name is {Name}.</p>
> ----
>
> And so I'd insert that template into {CONTENT} and then display the output.
>
> Can you give me an example as to how this would be done in Smarty?
> Thanks,
> Peter.
>
Something like this:
$somepage = new Smarty;
$somepage->assign("Name", "");
$content = $somepage->fetch("somepage.tpl");
$design = new Smarty;
$design->assign ("CONTENT", $content);
$design->display('design.tpl');
/Anders