css class conditional

JacquiiDesigns

Well-known member
Licensed customer
Say for instance I need to code a conditional within a div css class.
If logged in = this class --- If logged out = this class. Something like such:

<div class="this-if-registered" // "this-if-guest">

Wish I could explain it better. Hopefully someone can follow the above.
Is this possible?

J.
 
Thanks so much for the assistance guys.

Curly conditionals are good for this.

{xen:if '{$condition}', 'action_if_true', 'action_if_false'}

So...

<div class="{xen:if '{$visitor.user_id}', 'registered-class', 'guest-class'}">

I think I tried this actually, as someone in another thread suggested. It didn't work correctly. Could have totally been a typo though... But this code works wonderfully = Thanks Chris! ;)

J.
 
You could also create like a "customguest.css" then throw a conditional in page_container to call the stylesheet if they're a guest. This way instead of individually editing single divs, you put all of them in one style sheet.
 
Nice idea Russ - I just need a quick conditional though, as one of the ads I'm showing to guests only was overlapping the content area. So I had to adjust the min-height attribute only for the message template. Thanks again ya'll!

J.
 
No need to include extra css file, you can use .LoggedIn to separate css rules for guests and registered users:
Code:
.whatever { for guests; }
.LoggedIn .whatever { for registered users; }
 
Back
Top Bottom