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

Template conditional help

Discussion in 'XenForo Questions and Support' started by Itworx4me, Oct 13, 2010.

  1. Itworx4me

    Itworx4me Well-Known Member

    How do you define what the node id is?
    Code:
    xen:if is="{$forum.node_id}">
    	code
    <xen:else />
    	code
    </xen:if>
    
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Code:
    <xen:if is="{$forum.node_id} == 2">
        code
    <xen:else />
        code
    </xen:if>
    
     
    najaru likes this.
  3. Itworx4me

    Itworx4me Well-Known Member

    Can you help with another one that has plagued me?

    Is there a conditional for the forum home page?

    Thanks,
    Itworx4me
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I don't know of any conditional for that. But this is the content template for that page:

    Admin CP -> Appearance -> Templates -> forum_list

    Anything in that template will show exclusively on the index page.
     
  5. Itworx4me

    Itworx4me Well-Known Member

    Thanks for the help Jake. Are there any conditionals like if this script = index?

    Thanks,
    Itworx4me
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Not to my knowledge. I have seen this requested before.
     
  7. najaru

    najaru Active Member

    thanks.
    and for an array (multiple forums)?
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I haven't been able to find any array functions that work in the templates. I have already asked the devs about this. I'm not sure if we'll see this in a future beta or not.
     
  9. Itworx4me

    Itworx4me Well-Known Member

    Jake is there a way to use an array of nodes with this code?
    Like:
    Code:
    <xen:if is="{$forum.node_id} == 2,3,4">
     
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    najaru asked the same question 3 posts up. ;)

    I agree that array functions would be very useful here. I haven't been able to make it work though. I have asked the devs.
     
  11. Itworx4me

    Itworx4me Well-Known Member

    Tried using this code in the forum_list and page_container template with no success
    Any ideas why it doesn't work?
     
  12. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The $forum record isn't available to those templates. But it is available in thread_list and thread_view
     
  13. anotheralias

    anotheralias Well-Known Member

    I've been trying to take the breadcrumbs off the forum home page - this means it's impossible, right? Just so I know to give up.
     
  14. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Admin CP -> Appearance -> Templates -> PAGE_CONTAINER

    Replace this code:

    Code:
    						<!-- top breadcrumb, top ctrl -->
    						<div class="breadBoxTop">
    							<xen:if is="{$topctrl}"><div class="topCtrl">{xen:raw $topctrl}</div></xen:if>
    							<xen:include template="breadcrumb"><xen:set var="$microdata">1</xen:set></xen:include>
    						</div>
    
    ...with this:

    Code:
    						<!-- top breadcrumb, top ctrl -->
    						<xen:if is="{$contentTemplate} != 'forum_list'">
    						<div class="breadBoxTop">
    							<xen:if is="{$topctrl}"><div class="topCtrl">{xen:raw $topctrl}</div></xen:if>
    							<xen:include template="breadcrumb"><xen:set var="$microdata">1</xen:set></xen:include>
    						</div>
    						</xen:if>
    
    I tested this and it works.
     
    Digital Doctor and anotheralias like this.
  15. anotheralias

    anotheralias Well-Known Member

    It sure does! Thank you! *** hail emoticon****
     
  16. anotheralias

    anotheralias Well-Known Member

    Jake, I also used this to take the title of the board off the front page but leave the thread titles in place, and it seems to be working just fine ... is there any reason I shouldn't be doing this?
     
    Digital Doctor likes this.
  17. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Nope. That's fine. ;)
     
    anotheralias likes this.
  18. anotheralias

    anotheralias Well-Known Member

    Thanks Jake! :) Two problems solved with one stone!
     
  19. Brogan

    Brogan XenForo Moderator Staff Member

    An easier way to do that is edit the forum_list template from this <xen:h1>{$xenOptions.boardTitle}</xen:h1> to this <xen:h1></xen:h1>

    Just have empty tags - it works on Pages too.
     

Share This Page