Use if-statement to choose stylesheet [SOLVED]

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
Recon
Forum Members
Forum Members
Posts: 200
Joined: Sat Oct 09, 2010 10:23 am

Use if-statement to choose stylesheet [SOLVED]

Post by Recon »

Hi,

I am trying to change site's css styles comparing which page are loaded.

Is there a smarty for choosing what stylesheet are used? For example if statement to head-section? I'd like to use only one template

{if $page_alias eq "home"}
{cms_stylesheet= SOMENTHIN}
{elseif $page_alias eq "gallery"}
{cms_stylesheet= SOMENTHIN}
{/if}

Thank you
Recon
Last edited by Recon on Sat Feb 12, 2011 6:19 pm, edited 1 time in total.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: Use if-statement to choose stylesheet

Post by RonnyK »

sure, that is possible....

Just dont attach the stylesheets to the template, and call them conditionally as you described.

Ronny
Recon
Forum Members
Forum Members
Posts: 200
Joined: Sat Oct 09, 2010 10:23 am

Re: Use if-statement to choose stylesheet

Post by Recon »

Hi Ronny,

I removed all attached stylesheet and try to call only one stylesheet named stylesheet like this : {cms_stylesheet= "stylesheet"} it gives me an error:

string(137) "Smarty error: [in tpl_head:44 line 5]: syntax error: unrecognized tag: cms_stylesheet= "stylesheet" (Smarty_Compiler.class.php, line 446)" string(110) "Smarty error: [in tpl_head:44 line 5]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)"

-R
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Use if-statement to choose stylesheet

Post by Dr.CSS »

Read the Help of the tag to see how to call them...
Recon
Forum Members
Forum Members
Posts: 200
Joined: Sat Oct 09, 2010 10:23 am

Re: Use if-statement to choose stylesheet

Post by Recon »

Oh... there was help... I'm still learning :P

And for other noobs: It was like this:

{cms_stylesheet name='stylesheet'}
Post Reply

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