Re: [SMARTY-DEV] Quick Question

From: Date: Tue, 25 Mar 2003 07:42:27 +0000
Subject: Re: [SMARTY-DEV] Quick Question
References: 1 2  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-1011@lists.php.net to get a copy of this message
Subclass the Smarty class like this (pseudo code): class mySmarty extends Smarty { function fetch( $template, ... ) { if ($this->template_exists("$user/foo.tpl")) $this->fetch("$user/$template", ...) else $this->fetch($template', ...); } } Then your class searches for the template by itself. bye, André "Luis" <luis@fuegolabs.com> schrieb im Newsbeitrag news:001901c2f230$c75f78b0$2b00a8c0@fuegolabs.com... > Ok, ok I deserve it :-) > The idea is that I have a zillion > $smarty->display('foo.tpl'); lines and I don't want to change > them, I want display to search for templates first in > templates/$user/template.tpl and > then in templates/$user/template.tpl > Which is the best approach? Is there any way to change the default file: > resource? Other method? > > Luis > > -----Original Message----- > From: Monte Ohrt [mailto:monte@ispi.net] > Sent: Monday, March 24, 2003 2:33 PM > To: luis > Cc: Smarty Dev > Subject: Re: [SMARTY-DEV] Quick Question > > if($smarty->template_exists("$user/foo.tpl")) > $smarty->display("$user/foo.tpl") > else > $smarty->display('foo.tpl'); > > > > > On Mon, 2003-03-24 at 08:44, luis wrote: > > Hi, > > > > Let's say I have a > > $smarty->display('foo.tpl'); > > I want display to search in templates/$user/foo.tpl and if the > template > > is not found there to search in templates/foo.tpl > > Which is the best way to do it? > > > > Thanks for your answer. > > Luis > -- > Monte Ohrt <monte@ispi.net> > > > -- > Smarty Development Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.smarty.dev (#1011) next »