Template conditional help

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>
 

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
 

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.
 

Itworx4me

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

Thanks,
Itworx4me
 

Jake Bunce

XenForo moderator
Staff member
thanks.
and for an array (multiple forums)?
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.
 

Jake Bunce

XenForo moderator
Staff member
Jake is there a way to use an array of nodes with this code?
Like:
<xen:if is="{$forum.node_id} == 2,3,4">
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.
 

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
 

Jake Bunce

XenForo moderator
Staff 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.
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.
 

anotheralias

Well-known member
Admin CP -> Appearance -> Templates -> PAGE_CONTAINER
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>
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?
 

Brogan

XenForo moderator
Staff 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?
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.
 
Top