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

Logic Operators in Templates

Discussion in 'XenForo Questions and Support' started by Ryan Kent, Mar 10, 2011.

  1. Ryan Kent

    Ryan Kent Well-Known Member

    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>
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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>
    
     
    Oracle likes this.
  3. Ryan Kent

    Ryan Kent Well-Known Member

    perfect! Thx for the lesson once again Jake.
     
  4. Itworx4me

    Itworx4me Well-Known Member

    I am interested in this....Which template do you put the code in to achieve the results?
     
  5. Ryan Kent

    Ryan Kent Well-Known Member

  6. Itworx4me

    Itworx4me Well-Known Member

  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  8. Itworx4me

    Itworx4me Well-Known Member

    EWRporta_Portal is the replacement for portal_page for anyone wanting to know....
     

Share This Page