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

Logic Operators in Templates

Ryan Kent

Well-known member
#1
Can someone share how the "OR" condition is represented? I am trying to modify the first line below to say if the page is forum_list OR the portal page, don't show the bottom breadcrumb.

Code:
<xen:if is="{$contentTemplate} != 'forum_list'">
            <div class="breadBoxBottom"><xen:include template="breadcrumb" /></div>
<xen:else />
</xen:if>
 

Jake Bunce

XenForo moderator
Staff member
#2
I think you want this:

Code:
<xen:if is="{$contentTemplate} != 'forum_list' AND {$contentTemplate} != 'portal_page'">
	<div class="breadBoxBottom"><xen:include template="breadcrumb" /></div>
</xen:if>
This will show the breadcrumb on all pages except forum_list and portal_page. I don't know what the content template for your portal is called. I just put portal_page in there.

Here is an alternative condition using array functions. It's cleaner and easier to expand on:

Code:
<xen:if is="!in_array({$contentTemplate}, array('forum_list','portal_page'))">
	<div class="breadBoxBottom"><xen:include template="breadcrumb" /></div>
</xen:if>
 

Itworx4me

Well-known member
#4
I think you want this:

Code:
<xen:if is="{$contentTemplate} != 'forum_list' AND {$contentTemplate} != 'portal_page'">
	<div class="breadBoxBottom"><xen:include template="breadcrumb" /></div>
</xen:if>
This will show the breadcrumb on all pages except forum_list and portal_page. I don't know what the content template for your portal is called. I just put portal_page in there.

Here is an alternative condition using array functions. It's cleaner and easier to expand on:

Code:
<xen:if is="!in_array({$contentTemplate}, array('forum_list','portal_page'))">
	<div class="breadBoxBottom"><xen:include template="breadcrumb" /></div>
</xen:if>
I am interested in this....Which template do you put the code in to achieve the results?