Conditionals in EXTRA.css

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?
 

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

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

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>
 
Reactions: Ray

Ray

Active 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>
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh!!! Didn't think of that... Let me see if it works.
 
Top