Page 1 of 1
[solved] seasonal look? automatically switching templates?
Posted: Fri Oct 22, 2010 8:44 pm
by CMSMSrocks!
Hi everybody!
I have a a questions concerning templates, is there a way to automatically switch between them, based on a date? To get a seasonal look, with summer/winter/easter templates?
Re: seasonal look? automatically switching templates?
Posted: Fri Oct 22, 2010 8:58 pm
by RonnyK
This post is in Dutch

But it explains how to setup the cms_stylesheet, to act with different coloring based on time. But you could set this to seasons instead...
http://forum.cmsmadesimple.org/index.ph ... #msg215895
Ronny
P.S. There is also a tutorial about the seasons, I might be able to find that, but that might be a little later if needed... Tomorrow I will leave for a small holiday...
Re: seasonal look? automatically switching templates?
Posted: Fri Oct 22, 2010 9:11 pm
by CMSMSrocks!
I have a look!
Thanks for the extremely fast reply!

Re: seasonal look? automatically switching templates?
Posted: Sun Oct 24, 2010 2:27 am
by CMSMSrocks!
Here what I ended up doing:
1. Create different stylesheets, e.g. xmas_css, valentine_css
2. Attach both css templates to the html Template!
3. Insert this into your html template header, replace {cms_stylesheet} with the following:
Code: Select all
{capture assign="currentmonth"}{$smarty.now|date_format:"%m"}{/capture}
{capture assign="currentday"}{$smarty.now|date_format:"%d"}{/capture}
{if $currentmonth == 12 && $currentday < 25 }
{cms_stylesheet name="xmas_css"}
{elseif ( $currentmonth == 1 && $currentday > 28 ) or ( $currentmonth == 2 && $currentday < 15 ) }
{cms_stylesheet name="valentine_css"}
{/if}
It worked perfectly for me this way. However, at first, I tried to do it directly in only ONE css template and it wouldn't work nicely because {cms_stylesheet} is cached!
Credits for this solution:
http://forum.cmsmadesimple.org/index.php?topic=43550.0