[solved] seasonal look? automatically switching templates?

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
CMSMSrocks!
New Member
New Member
Posts: 5
Joined: Fri Oct 22, 2010 8:22 pm

[solved] seasonal look? automatically switching templates?

Post 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?
Last edited by CMSMSrocks! on Sun Oct 24, 2010 10:02 pm, edited 1 time in total.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: seasonal look? automatically switching templates?

Post 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...
CMSMSrocks!
New Member
New Member
Posts: 5
Joined: Fri Oct 22, 2010 8:22 pm

Re: seasonal look? automatically switching templates?

Post by CMSMSrocks! »

I have a look!
Thanks for the extremely fast reply!  ;D
CMSMSrocks!
New Member
New Member
Posts: 5
Joined: Fri Oct 22, 2010 8:22 pm

Re: seasonal look? automatically switching templates?

Post 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
Post Reply

Return to “Layout and Design (CSS & HTML)”