|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Jerc Smarty Rookie
Joined: 26 Jan 2010 Posts: 30 Location: Slovenia / Ljubljana
|
Posted: Wed Jun 13, 2012 2:38 pm Post subject: Themes |
|
|
Hi.
Maybe you guys could solve my problem or give me the best solution.
I would like to achieve something like Drupal Theme system.
I have created default design:
with files:
Code: | index.tpl
head.tpl
foot.tpl |
Code: | $smarty->setTemplateDir('/themes/default/'); |
Then i've added new theme "basic"
Code: | $smarty->addTemplateDir('/themes/basic/'); |
with one file
I would like: if the template exists in the /basic folder, then smarty should use /themes/basic/head.tpl and not /themes/default/head.tpl
I don't want to change my entire code and add
if template exists in the basic folder then
display it from basic folder
else
display default template
i wish to keep the code as it is:
display head.tpl or {include file="head.tpl" in the template
Thanks for the solutions. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Jun 13, 2012 7:03 pm Post subject: |
|
|
With your code Smarty does search the folders in the wrong order (default first and then basic).
Use Code: |
$smarty->setTemplateDir(array('/themes/basic/','/themes/default/')); |
|
|
Back to top |
|
Jerc Smarty Rookie
Joined: 26 Jan 2010 Posts: 30 Location: Slovenia / Ljubljana
|
Posted: Fri Jun 15, 2012 5:35 am Post subject: |
|
|
It's working now.
Many thanks! |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|