Page 1 of 1

Use if-statement to choose stylesheet [SOLVED]

Posted: Sat Feb 12, 2011 1:40 pm
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

Re: Use if-statement to choose stylesheet

Posted: Sat Feb 12, 2011 2:30 pm
by RonnyK
sure, that is possible....

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

Ronny

Re: Use if-statement to choose stylesheet

Posted: Sat Feb 12, 2011 5:58 pm
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

Re: Use if-statement to choose stylesheet

Posted: Sat Feb 12, 2011 5:59 pm
by Dr.CSS
Read the Help of the tag to see how to call them...

Re: Use if-statement to choose stylesheet

Posted: Sat Feb 12, 2011 6:19 pm
by Recon
Oh... there was help... I'm still learning :P

And for other noobs: It was like this:

{cms_stylesheet name='stylesheet'}