Simple CSS switch

Permalink
Hi ... Instead of change the hole theme, It would be great with a simple way in dashboard
to switch the different ccs files,

eg.. main.css > main_christmas.css

Cheers
Flemming

 
Hypocrite replied on at Permalink Reply
Hypocrite
I have done this easily with attributes.

You could have an attribute named for example "css_theme".

And then in your template do something like:

<link rel="stylesheet" href="main.css">
<?php
if($c->getAttribute('css_theme'):
?>
<link rel="stylesheet" href="<?php echo $c->getAttribute('css_theme'); ?>.css">
<?php
endif;
?>


The attribute css file contains only those styles which overwrite styles from main.css like for example the background image.
pauk replied on at Permalink Reply
Ohh Thanks

Nice solution :-)

BUT for a client it woulld be great for a simple way to change in dashboard .. if I designed
winter, spring, summer and so on..

ALSO would bed great with date,time activation
thakurtech replied on at Permalink Reply
thakurtech
Nice solution.

If I am not wrong is this page attribute you are talking about. So that css can be changed at the page level.
Hypocrite replied on at Permalink Reply
Hypocrite
Yes, page attribute.

Of course you can also time the CSS for the theme in your template with PHP if you want to show the different theme during a time period.

Or add these as date attributes also but that might get a bit complicated to manage. Something like:
Christmas period start
Christmas period end
Summer period start
Summer period end
Spring period start
Spring period end