Re: [SMARTY] Is there a way to include different files from a template?

From: Date: Thu, 16 May 2002 11:40:57 +0000
Subject: Re: [SMARTY] Is there a way to include different files from a template?
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-4213@lists.php.net to get a copy of this message
Peter, Yup, it's easy. <? if ($mode == "news") $smarty->assign("template", "news.tpl"); else if $mode == "calendar) $smarty->assign("template", "calendar.tpl"); $smarty->display("blah.tpl"); ?> blah.tpl --------- {include file=$template} On this note, is it possible to do any kind of string concatenation inside smarty? Something like: <? if ($mode == "news") $smarty->assign("template", "news"); else if $mode == "calendar) $smarty->assign("template", "calendar"); $smarty->display("blah.tpl"); ?> blah.tpl --------- {include file="$template.tpl"} Ben On Thursday, May 16, 2002, at 12:32 PM, Peter Schumacher wrote:
Hi Guys, I'm working on a site that has the usual news, calendar etc. I know that it's possible to include a template from a template. But is it possible to specify this in a dynamic way? An example, // Main Template bla bla bla if $mode=news include news.tpl if $mode=calendar include calendar.tpl bla bla bla Regards, Peter Schumacher -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.smarty.general (#4213) next »