• 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.

How To Add A New Tab In The Navbar

Jake Bunce

Well-known member
This will create a simple tab link in the navbar. No popup or submenu. Here is a picture of what it looks like (in this example the user wanted a link for Account Upgrades):

Screen shot 2010-11-08 at 11.41.25 AM.webp

Edit this template:

Admin CP -> Appearance -> Templates -> navigation

Add the red code, and change the blue parts appropriately:

Rich (BB code):
						<li><a href="{xen:link 'find-new/threads'}">{xen:phrase whats_new}</a></li>
					</ul>
				</div>
			</li>
		</xen:if>


		<!-- mytab -->
		<li class="navTab PopupClosed"><a href="LINK" class="navLink">TAB LABEL</a></li>


		<!-- extra tabs -->
		<xen:if is="{$extraTabs}">
		<xen:foreach loop="$extraTabs" key="$extraTabId" value="$extraTab">
			<xen:if is="{$extraTab.linksTemplate}">

While you can 'hard code' the LINK and TAB LABEL, ideally you should use xen:link and xen:phrase. For example, here is the proper code for the Account Upgrades picture above:

Rich (BB code):
		<!-- mytab -->
		<li class="navTab PopupClosed"><a href="{xen:link account/upgrades}" class="navLink">{xen:phrase account_upgrades}</a></li>
 
Thank you Jake :)

One question, the new tab stay in front of others when one click it ?
 
One question, the new tab stay in front of others when one click it ?

This tab doesn't turn active when you visit its page. That can be done with a proper code event listener like what ragtek posted. That means you need to delve into the code.
 
That's why it would be great, to have an "Menu Manager" where we could create & edit the menu entries

Put it up as a request, a modder might take this on, though it would be best suited as a core feature.
 
This tab doesn't turn active when you visit its page. That can be done with a proper code event listener like what ragtek posted. That means you need to delve into the code.

The fact that it doesn't turn active would work out perfectly for me if it's possible to put the "what's new" link in that tab. Is there any reason I shouldn't?

(Why - because it saves a click. "Inbox/Forum/what's new" vs. "inbox/what's new")
 
The fact that it doesn't turn active would work out perfectly for me if it's possible to put the "what's new" link in that tab. Is there any reason I shouldn't?

(Why - because it saves a click. "Inbox/Forum/what's new" vs. "inbox/what's new")

That's fine. Here is the code for your What's New tab:

Code:
		<!-- mytab -->
		<li class="navTab PopupClosed"><a href="{xen:link 'find-new/threads'}" class="navLink">{xen:phrase whats_new}</a></li>
 
Nice guide Jake.

One small change I would make though would be to add a guest conditional, so the tab doesn't show up if not logged in.
That can be achieved with the following:
HTML:
<xen:if is="{$visitor.user_id}">
<li class="navTab PopupClosed"><a href="{xen:link account/upgrades}" class="navLink">{xen:phrase account_upgrades}</a></li>
</xen:if>
 
Which menu?

Just change the order of the tabs in the template for how you want them to appear on the nav bar.
 
Done

Code:
                <!-- mytab -->
        <li class="navTab PopupClosed"><a href="LINK" class="navLink">MENU</a></li>

        <!-- no selection -->
        <xen:if is="!{$selectedTab}">
            <li class="navTab selected"><div class="tabLinks"></div></li>
        </xen:if>
 
Back
Top Bottom