• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

If condition for style?

AzzidReign

Well-known member
#1
Is there an if condition that allows for showing certain content on certain styles? Reason I ask is bc of an addon, I'd like to wrap it in a conditional so it shows 1 thing on my main style and another thing on my mobile style.
 

cclaerhout

Well-known member
#3
In templates, the variable to check is
Code:
{$visitorStyle.style_id}
In php (through a template listener) you can get this variable doing:
PHP:
$style_session = $template->getParam('visitorStyle');
$styleId = $style_session['style_id'];
Edit: so the conditional in template would be:
Code:
{xen:if "{$visitorStyle.style_id} == X", "Do this", "Else do that"}
X being a number (your styleid)
or
Code:
<xen:if is="{$visitorStyle.style_id} == X">
Do this
<xen:else />
Do that
<xen:if />
 

AzzidReign

Well-known member
#4
In templates, the variable to check is
Code:
{$visitorStyle.style_id}
In php (through a template listener) you can get this variable doing:
PHP:
$style_session = $template->getParam('visitorStyle');
$styleId = $style_session['style_id'];
Edit: so the conditional in template would be:
Code:
{xen:if "{$visitorStyle.style_id} == X", "Do this", "Else do that"}
X being a number (your styleid)
or
Code:
<xen:if is="{$visitorStyle.style_id} == X">
Do this
<xen:else />
Do that
<xen:if />
Thank you much. For some reason if conditionals don't work well with digitalpoint's ad positioning. :(