How do I use a conditional for a specific node in a template?

Paul B

XenForo moderator
Staff member
I want to try and remove the breadcrumbs from a specific page.

So I started off by editing the PAGE_CONTAINER template like so:
PHP:
<xen:if is="{$node.node_id} !={$page.node_id}">
<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>

The if statement is my addition to try and remove the breadcrumbs for any node which is a page but it doesn't work.
It actually removes the (top) breadcrumb from every page view.

Ultimately I want to be able to change the xen:if to use a specific node id (55) so I can use a Page as the home page without the breadcrumbs top and bottom.

Help appreciated :D
 
Make it a step simpler? If page.node_id is not set, show breadcrumb.
 
in PAGE_CONTAINER the $page.node_id is always empty it seems.
 
Go easy on us learners :D

I tried using <xen:if is="{$node.node_id} != {$page.node_id}"> and that removes the breadcrumbs from every node.

Similarly if I use <xen:if is="{$node.node_id} == {$page.node_id}"> then the breadcrumbs are visible on every node.

I can't seem to remove them just for page nodes.
 
Try checking if {$node.node_type_id} == 'Page'. node_type_id can be either Page, Forum, LinkForum, or Category (possibly more if you have an addon that defines more).
 
Why dont you just use:

Code:
<xen:if is="{$node.node_type_id} != 'Page'">

edit: looks like Indigo already answered it... oops
 
It sounds like you wanted to hide the breadcrumbs from a page node with ID = 55? Technically you shouldn't even need to check the type.
Code:
<xen:if is="{$node.node_id} != 55">
<!-- breadcrumbs -->
</xen:if>
Unless $node is not defined in that context.
 
Still not working :D

I should turn this into a competition to see who can work it out first.
I have a feeling though it's not possible in this particular template.
 
I've tried it there also, without success.

Oh well, I'll put it on the back-burner for now.

I just thought it would have been nice to show pages without the breadcrumbs so they looked less like part of the forum and more like an html page with the same header and footer.
 
http://www.anfinitinetwork.com/xftest/pages/testing/

Did it with:
Code:
<xen:if is="{$quickNavSelected} != 'node-3'">
	<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>
Replace "node-3" with "node-55" or any number you want. Repeat for bottom breadcrumbs if necessary. This was in beta 3 (haven't gotten around to upgrading), so hopefully quickNavSelected hasn't changed since then.
 
http://www.anfinitinetwork.com/xftest/pages/testing/

Did it with:
Code:
<xen:if is="{$quickNavSelected} != 'node-3'">
	<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>
Replace "node-3" with "node-55" or any number you want. Repeat for bottom breadcrumbs if necessary. This was in beta 3 (haven't gotten around to upgrading), so hopefully quickNavSelected hasn't changed since then.

Does this still work xenforo RC1 ?
 
Top Bottom