Re: [SMARTY] Relative includes?

From: Date: Wed, 22 Dec 2004 08:22:32 +0000
Subject: Re: [SMARTY] Relative includes?
References: 1 2 3 4 5  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-12071@lists.php.net to get a copy of this message
On Tue, Dec 21, 2004 at 09:22:01PM +0100, Rainer Müller wrote: > Monte Ohrt wrote: > >Dieter Erdmann wrote: > > > >>Hi, > >> > >> > >> > >>>> { include file="subdir/inc.tpl"; } > >>>> > >>>>It seems that the include path is always relative to the 'templates' > >>>>root > >>>>directory instead of the current directory (i.e. the directory of the > >>>>current template). Is there a way to get local includes working? > >>>> > >>> > >>>Make the subdir your Smarty template dir. > >>> > >> > >> > >>Hmmm the whole point is actually to have a directory hierarchy in my > >>project. I don't want to put all templates in the same directory... > >> > >>cu > >>Dieter > >> > >> > >> > > > >Why not do something like: > > > >$theme = 'foobar'; > >$smarty->assign('theme', $theme); > >$smarty->display("$theme/index.tpl"); > > > >Then in the templates: > > > >{include file="$theme/header.tpl"} > > Shouldn't that be {include > file="$theme/header.tpl"}? Or was this > restriction only for older versions? no, both work. backticks are optional on single variables (like here), but they are necessary for complex variables like array-elements or object-properties. > Rainer > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

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