[SOLVED] Different stylesheets for different pages

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
chriggi
New Member
New Member
Posts: 5
Joined: Wed Nov 11, 2009 5:33 pm

[SOLVED] Different stylesheets for different pages

Post by chriggi »

Hey everybody!

I want to have different stylesheets for different pages. I have already tried the following:

Code: Select all

{if $title eq "Home"}
   {cms_stylesheet}
{else}
   <link rel="stylesheet" type="text/css" href="*LINK TO ALTERNATIVE CSS FILE*" />
{/if}
Any help on this?

Thanks for reading!
Last edited by chriggi on Thu Jan 31, 2013 1:53 pm, edited 1 time in total.
chriggi
New Member
New Member
Posts: 5
Joined: Wed Nov 11, 2009 5:33 pm

Re: Different stylesheets for different pages

Post by chriggi »

My bad I did not read the following:
http://forum.cmsmadesimple.org/viewtopi ... =8&t=14878
2) When editing page, or module templates, sometimes it isn't obvious what variables are available and how you
can use them.
For this, you need two things:
a) The {get_template_vars} smarty plugin
This smarty plugin is used in debugging and development to list all of the variables that smarty knows about
and their types. When working in any new (to you) template you should use this to see what variables are
available.
This is how it should be:

Code: Select all

{if $page_name eq "Home"}
   {cms_stylesheet}
{else}
   <link rel="stylesheet" type="text/css" href="*LINK TO ALTERNATIVE CSS FILE*" />
{/if}
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: [SOLVED] Different stylesheets for different pages

Post by Dr.CSS »

You can also use {cms_stylesheet name='diffstyle'} instead of linking to a flat file style sheet...
Post Reply

Return to “CMSMS Core”