Problems with {include} and a changing template dir
| From: | Håvard Lindset | Date: | Wed, 28 Aug 2002 17:26:30 +0000 |
| Subject: | Problems with {include} and a changing template dir | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-5854@lists.php.net to get a copy of this message | ||
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