• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Nodes As Tabs (with tab selection)

Not open for further replies.

Jake Bunce

XenForo moderator
Staff member
This addon now lives in the resource manager:

Paypal donations can be sent to donate@mscclan.com

New NodesAsTabs Addon (compatible with 1.1.x only, tested on 1.1.0)

Versions: (attached below)
- NodesAsTabs 1.1.1.zip (current version)
- - - security patch and some code cleaning
- - - the older versions are now removed because they were insecure
- NodesAsTabs110-3.zip
- - - added option for "mark read" link
- - - added option to enable / disable popup menu for secondary links
- NodesAsTabs110-2.zip
- - - fixed untabbed thread / post routes
- - - removed forced category pages in favor of a warning when appropriate
- NodesAsTabs110.zip

In response to requests for additional features I made a more fully-featured tab addon. Here are the highlights:

- Allows you to display any node as a tab in the navbar.
- Supports all node types (not just page nodes).
- Supports tab selection when you enter a tab node.
- All child nodes and other content underneath a tab node will continue to show that parent tab as being selected in the navbar. That includes children of a tab node down to any depth as well as threads and posts inside of those nodes. The containing tab will continue to show as selected.
- Breadcrumbs under a tab node are modified to be rooted to that node so that crumbs for higher level nodes (above the tab) are not shown.
- Tab nodes may contain other tab nodes. The "closest" tab will take precedence when it comes to determining which tab to select.
- Each node gets its own tab configuration options as shown in this picture:

Screen shot 2011-11-27 at 2.36.40 AM.png

- The node list has an indicator for tab nodes so you can quickly see which nodes are tabs:

Screen shot 2011-11-20 at 12.06.42 AM.png

- And finally, here is a picture of a tab node on the front end:

Screen shot 2011-11-19 at 6.06.31 PM.png Screen shot 2011-11-20 at 1.12.13 AM.png Screen shot 2011-11-20 at 1.12.36 AM.png

For those who are curious about the technical details...

1) This addon creates one new table called nat_options. All data for this addon is contained in that table. It doesn't change anything else in the database. As such, this addon can be disabled or uninstalled very easily without any lasting effects.

2) This addon adds 1-3 queries to every page. If you choose to check child permissions then that's an extra query for each tab that checks child permissions. This is noted in the description of that setting when you edit a node.

3) There is an inconsequential problem with notices and body classes. "Inconsequential" meaning it doesn't affect the majority of users, and you can easily work around the problem if you are affected by it. See this post for details.


Old PageNodesAsTabs Addon (compatible with 1.0.x and 1.1.x, and replaced by the new NodesAsTabs addon for 1.1.x)

Versions: (attached below)
- PageNodesAsTabs.zip (current version)

This addon creates nav tabs for your page nodes if they are not set to display in the node list:

Admin CP -> Applications -> Display Node Tree -> [click the page node] -> Display in the node list

Screen shot 2011-11-15 at 7.21.04 PM.png

When this is unchecked the page node will display as a nav tab.

The nav tabs use the display order of the page nodes to determine their order amongst themselves in the navbar.

There are three positions for nav tabs: home, middle, and end. This addon uses a range of display orders to know which position to use:

Display Order = Position:
1-9 = home
10-19 = middle
20+ = end

This addon also respects node permissions. If a user is not allowed to view a particular page node then its tab will not show.

If you want to add secondary links under your tabs then you need to create a new template using the URL portion of the page node:

Admin CP -> Appearance -> Templates -> Create New Template

Template Name: pagesnavtab_mypage


<ul class="secondaryContent blockLinksList">
	<li><a href="{xen:link 'url1'}">Text1</a></li>
	<li><a href="{xen:link 'url2'}">Text2</a></li>
Here is a picture:

Screen shot 2011-11-15 at 11.22.22 PM.png



Well-known member
I was just searching to see if there was anything written that might fulfil this function. Very timely for me and very much appreciated :)

Jake Bunce

XenForo moderator
Staff member
Nice Jake :)

An screen please ^-^
There isn't much to see as it just creates a selected tab for a page node. Here is a picture:

Screen shot 2011-11-15 at 11.22.22 PM.png

And I see now that this addon fudges the breadcrumbs a bit. You can see in the picture... My Page is inside of Main Category but the crumbs are reversed. I will fix that and post an update. In fact, I should probably have the addon remove the category from the breadcrumbs. That would be appropriate for tab pages like this.

Jake Bunce

XenForo moderator
Staff member
I fixed the breadcrumb thing and updated the zip file. If you downloaded the original copy then just download again and upgrade:

1) Upload the new files.

2) Import the addon XML file again as an upgrade. Or uninstall then install again. Same difference.


Well-known member

Just wondering if theres a way to include a tab in the navbar to a page without the dropdown? Sometimes id just like to link to a page and have no dropdown in the menu. Will this be possible for the future? thanks

Jake Bunce

XenForo moderator
Staff member
Is it possible to do this with forums and categories?
Yeah it's possible. I may expand this addon to cover those other node types.

Great mod, hope you develop it a bit more so it has easier options to use.
It just overloads the existing node options of Display Order and Display in the node list. I prefer not to add any more configurable options unless necessary. The current method works well and has an elegance about it. Is there something you found difficult to use?

Just wondering if theres a way to include a tab in the navbar to a page without the dropdown? Sometimes id just like to link to a page and have no dropdown in the menu. Will this be possible for the future? thanks

Remove the red code leaving only empty single quotes:

			foreach ($pagesSorted AS $page)
				$visitor->setNodePermissions($page['node_id'], $page['node_permission_cache']);
				if ($pageModel->canViewPage($page))
					$extraTabs['pages' . $page['node_name']] = array(
						'title' => $page['title'],
						'href' => XenForo_Link::buildPublicLink('full:pages', $page),
						'position' => ($page['display_order'] < 10 ? 'home' : ($page['display_order'] < 20 ? 'middle' : 'end')),
						'linksTemplate' => 'pagesnavtab_' . $page['node_name']
I had defined a generic link template for each tab to allow people to create sublinks under their tabs. But I didn't realize that it created an empty dropdown menu. Maybe I will remove that option. I suspect dropdowns will mostly go unused for this modification. I could add a configurable option for each node but I prefer to keep things simple and not mess with the data structures.
Not open for further replies.