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

Conditionals in EXTRA.css

Discussion in 'XenForo Questions and Support' started by Ray, Mar 21, 2011.

  1. Ray

    Ray Active Member

    I want to hide videos from some media sites in plain view using css, not sure if it's possible but here is what I did:
    EXTRA.css
    HTML:
    <xen:if is="!{$visitor.user_id}">
    DIV.hidevideo
    {
    display:none
    }
    </xen:if>
    From BB Code Media Sites, I wrapped the embed code with:
    HTML:
    <DIV class="hidevideo"> embed html code </DIV>
    The video should be hidden from guests and viewable by members. Currently, no one can view them.
    Maybe xf conditionals cannot be used in EXTRA.css?
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    You can only use CSS in EXTRA.css.
     
    Ray likes this.
  3. James

    James Well-Known Member

    I don't think you can use conditionals in any CSS files.

    Do it the other way and apply the class of hidevideo to the template:
    Code:
    class="{xen:if '!{$visitor.user_id}', 'hidevideo'}"
     
    Ray and Floris like this.
  4. Ray

    Ray Active Member

    I know :( ... do you know if there is any way I could hide videos from guests only?
     
  5. James

    James Well-Known Member

     
    Ray likes this.
  6. Ray

    Ray Active Member

    Thanks, but to which template?
     
  7. James

    James Well-Known Member

    The template that applies the BBCode. If there's no template, just apply the CSS to the page container (or any of the head files) with a conditional. You can use conditionals in templates, so you could use your conditional as long as it's in a template.
    Code:
    <xen:if is="!{$visitor.user_id}">
    <style>
    //code
    </style>
    </xen:if>
    
     
    Ray likes this.
  8. Brogan

    Brogan XenForo Moderator Staff Member

  9. Ray

    Ray Active Member

    ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh!!! Didn't think of that... Let me see if it works.
     
  10. Ray

    Ray Active Member

    Thanks, guys! You are very helpful...as always! (y)
     
    Floris likes this.

Share This Page