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

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

Brogan

XenForo moderator
Staff member
#1
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
 

Brogan

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

Indigo

Active member
#7
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).
 

Jaxel

Well-known member
#8
Why dont you just use:

Code:
<xen:if is="{$node.node_type_id} != 'Page'">
edit: looks like Indigo already answered it... oops
 

Indigo

Active member
#10
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.
 

Brogan

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

Brogan

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

Indigo

Active member
#16
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.
 

Digital Doctor

Well-known member
#19
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 ?