Re: [SMARTY] switch substitute
| From: | John Wards | Date: | Mon, 07 Oct 2002 09:13:19 +0000 |
| Subject: | Re: [SMARTY] switch substitute | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6100@lists.php.net to get a copy of this message | ||
I dunno if this helps but here you go.....
I have a template with the variable {$content} in it. I need to display either
html from another template in this variable ot just text generated by my
script.
This is how I do it.
In my php code I have this....
$smarty->assign("content_assign", "temp1.tpl");
In my template.tpl file I have this.
{if $content_assign != ""}
{include file=$content_assign assign="content"}
{/if}
That would display temp1.tpl in the location of {$content}
Cheers
John Wards
SportNetwork.net
On Monday 07 Oct 2002 9:37 am, Simone wrote:
> I have a foo.php file
>
> foo.php ----
>
> <?php
> ...
>
> $smarty->assign('footer',"footer_a.tpl");
> $smarty->display('base.tpl');
>
> ...
> ?>
>
> Than I have my base.tpl where I want dispaly the right footer
> but your solution doesn't seems to work ...
>
> <html>
> <body>
> ...
>
> {include file=$smarty.get.footer}
>
> ...
> </body>
> </html>
>
>
> Probaly I have done something wrong ... :-(
>
> Anyway I have read the manual ... but the one that I had was quite small
> and almost without examples ... :-( Can you suggest me a good manual ?
>
> Simone
>
> On Sunday 06 October 2002 14:59, Josh Johnson wrote:
> > I should say RTFM, but when you specify a smarty variable, even the
> > special $smarty.get variable, inside of another template function (like
> > include), you just drop the delimiters ({}), so it would be:
> > {include file=$smarty.get.var}
> >
> > You really should read through the docs before you ask questions, this
> > is stressed over and over there. :)
> > -- Josh