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

XF 1.1 Could someone help me with my conditionals please?

petertdavis

Well-known member
#1
Howdy,
I'm trying to figure out how to do this and not getting it exactly right. I'm using the ad_above_top_breadcrumb template to show one set of ads to any visitor who isn't logged in, another set of ads to certain usergroups, and no ads to the rest. Here's what I have right now...

Code:
<xen:if is="{$visitor}">
<--------Ad Code----->
</xen:if>
 
<xen:if is="!{xen:helper ismemberof, $visitor, 42, 4, 5, 32, 43, 3}">
<center>
<--------Ad Code----->
</xen:if>
Thanks!
 

DBA

Well-known member
#2
Instead of using the is="{$visitor}", try using usergroups for both.

Code:
<xen:if is="{xen:helper ismemberof, $visitor, 1}">
This content will show to non logged in users (visitors)
</xen:if>
 
<xen:if is="{xen:helper ismemberof, $visitor, 42, 4, 5, 32, 43, 3}">
This content will show to members of user groups x or y
</xen:if>
 

Kevin

Well-known member
#3
You could also look for the User ID to identify the guests...
Code:
<xen:if is="{xen:helper ismemberof, $visitor, 42, 4, 5, 32, 43, 3}">
     <!-- Content for users in groups 42, 4, 5, 32, 43, & 3 -->
<xen:elseif is="!{$visitor.user_id}" />
     <!-- Content for users who are not logged in -->
</xen:if>