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

XF 1.2 Is there a list of template conditionals?

Discussion in 'Styling and Customization Questions' started by Code Monkey, Aug 9, 2013.

  1. Code Monkey

    Code Monkey Well-Known Member

    How would I check if the template used is one of 5 templates using conditionals? Say I have a list of templates and I only want to display something if I am viewing the pages that use those templates.

    Code:
    thisapp_public_index
    thisapp_public_page1
    thisapp_public_page2
    thisapp_public_page3
    member_view
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

  3. Code Monkey

    Code Monkey Well-Known Member

    Thanks

    So something like this might work?

    Code:
    <xen:if is="in_array({$contentTemplate}, array(thisapp_public_index, thisapp_public_page1, thisapp_public_page2, thisapp_public_page3, member_view))">
        //display the stuff
    </xen:if>
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Yes.
     
  5. Code Monkey

    Code Monkey Well-Known Member

    It throws an error on save. hmmm
     
  6. Code Monkey

    Code Monkey Well-Known Member

    Ahh this works. Need to quote the template names.

    Code:
    <xen:if is="in_array({$contentTemplate}, array('thisapp_public_index', 'thisapp_public_page1', 'thisapp_public_page2', 'thisapp_public_page3', 'member_view'))">
       //display the stuff
    </xen:if>
    
     
  7. Code Monkey

    Code Monkey Well-Known Member

  8. Brogan

    Brogan XenForo Moderator Staff Member

    I should pay more attention - was too busy eating dinner :D
     
    Code Monkey likes this.

Share This Page