RE: [SMARTY] Problems with {include} and a changing template dir

From: Date: Wed, 28 Aug 2002 18:39:55 +0000
Subject: RE: [SMARTY] Problems with {include} and a changing template dir
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5855@lists.php.net to get a copy of this message
This may be a silly question, but I'm assuming that the templates header.tpl and footer.tpl are also in the "blue" directory? Gary >-----Original Message----- >From: Håvard Lindset [mailto:elindset@hoved.net] >Sent: Wednesday, August 28, 2002 12:27 PM >To: smarty-general@lists.php.net >Subject: [SMARTY] Problems with {include} and a >changing template dir > > >Hi, > >I'm experiencing problems when I'm using {include} in >templates. It was working before when the templates >were under the hardcoded and default directory >'templates'. Right now I'm loading the template name >from a database (so it's possible to change template >fast). If I for example have selected a template named >'blue', the template directory would be '/templates/blue' > >Here is the code I'm using (there is of course more >code, but I've removed it to improve the readability): > >--- > >index.php > >$smarty->template_dir = "templates/" . $template_name; > >[...] > >$smarty->display("index.tpl"); > >--- > >templates/blue/index.tpl: > >{include file="header.tpl"} > > [...] > >{include file="footer.tpl"} > >--- > >What happens is that the files header.tpl and >footer.tpl aren't included. Does anyone have the >slightest idea why they aren't? The value retrieved >from the database is OK, so that's not the problem. > >Best regards, >Håvard Lindset >lindset@webpixels.net >

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