[Guide] Template Conditionals

Status
Not open for further replies.

Mikey

:mikey:
Staff member
Jan 26, 2008
17,836
692
510
33
Disunited Queendom
mikeylicio.us
How would I display something only if the user is online?

something like

Code:
<xen:if is="{$visitor.online} == 1">Code for online users</xen:if>
?

Not if the person who is viewing it is online, but if the user is online?
 

Vincent_imported

Trusted Member
Dec 1, 2010
747
0
100
28
Belgium
www.hlxbans.net
How would I display something only if the user is online?

something like

Code:
<xen:if is="{$visitor.online} == 1">Code for online users</xen:if>
?

Not if the person who is viewing it is online, but if the user is online?

If you mean "online" as in "logged in", then you can use
Code:
<xen:if is="{$visitor.user_id}">Code</xen:if>
 

Mikey

:mikey:
Staff member
Jan 26, 2008
17,836
692
510
33
Disunited Queendom
mikeylicio.us
If you mean "online" as in "logged in", then you can use
Code:
<xen:if is="{$visitor.user_id}">Code</xen:if>
Thanks, but I kinda mean differently.

Sort of how the banners for online and offline work in that mod over at xenforo.com, where they show if a user is online or offline with ribbons?
 

gldtn_imported

OMG Member
Feb 6, 2011
20
0
55
40
What is wrong with this?
Code:
<xen:if is="{xen:helper ismemberof, $user, x} AND {$user.is_admin} OR {$user.is_moderator}">
 

Floris

I'm just me :) Hi.
Staff member
Jan 1, 2001
60,101
1,425
930
47
Netherlands
mrfloris.com
for reference...

page_container template:

Code:
<p class="importantMessage">
controllerName: {$controllerName}, controllerAction: {$controllerAction} and viewName: {$viewName}.
</p>
 
  • Like
Reactions: 1 person

Floris

I'm just me :) Hi.
Staff member
Jan 1, 2001
60,101
1,425
930
47
Netherlands
mrfloris.com
The style.php or css.php is loaded in the header somwhere,
you can wrap this around a conditional and load a different style id, I believe.
 

Floris

I'm just me :) Hi.
Staff member
Jan 1, 2001
60,101
1,425
930
47
Netherlands
mrfloris.com
<xen:if is="{$user.customFields.country}">
If the field has data this text will be shown
</xen:if>

<xen:if is="{$user.customFields.country} == 'United Kingdom'">
If the field contains 'United Kingdom' this text will be shown
</xen:if>
 
Status
Not open for further replies.