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

If condition for style?

Discussion in 'Troubleshooting and Problems' started by AzzidReign, Jan 24, 2013.

  1. AzzidReign

    AzzidReign Well-Known Member

    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.
     
  2. Shelley

    Shelley Well-Known Member

    Couldn't you do that using this add-on? http://xenforo.com/community/resources/advanced-styling-rules.283/
     
  3. cclaerhout

    cclaerhout Well-Known Member

    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 />
    
     
  4. AzzidReign

    AzzidReign Well-Known Member

    Thank you much. For some reason if conditionals don't work well with digitalpoint's ad positioning. :(
     
  5. RoldanLT

    RoldanLT Well-Known Member

    DP addon doesn't accepts XenForo Conditionals.
    Maybe modify the core addon files will do.
     

Share This Page