Back to vBulletin 4.x Add-ons

Navbar Tabs for CMS Sections
Mod Version: 1.00, by hqarrse

vB Version: 4.1.2 Rating: (1 vote - 5.00 average) Installs: 10
Released: 07 Mar 2011 Last Update: Never Downloads: 0
Not Supported Uses Plugins Template Edits  

*********** obsolete from VB 4.2 - see my post #24 for the much better way of doing it using Andreas' extension to the new Nav Manager *************

The lack of ability to put links to CMS sections as tabs in the Navbar seems a bizarre oversight, however... solved to some extent although pretty clunky:

This will work if you are adding navbar tabs for a top level section, ie. one that is not a sub section of your CMS home. That tab will then become 'selected' for that section, subsections and articles. It can probably we adapted for other situations.

Anything in CAPS below needs to be filled in with your own values.

Firstly you need to get the top level section ID (we have sub sections so just the section id is not enough) as a variable available to the Navbar and vbcms_navbar_link templates. The only way I have found to get this is to take the first item in the breadcrumb array. The plugin to do this is:

Hook: vbcms_content_populate_start
Code:
global $bci;
$bci = $this->content->getBreadcrumbInfo();
vB_Template::preRegister('navbar',array('top_parent' => $bci[0]['nodeid']));
vB_Template::preRegister('vbcms_navbar_link',array('top_parent' => $bci[0]['nodeid']));
Now we need a new tab for our section. Creating a tab is described in various places on vb.org, but in a nutshell the plugin is:

location: process_templates_complete
Code:
global $bci;
$tabselected = ''; 
$tablinks = ''; 
if ($bci[0]['nodeid'] == YOUR SECTION ID) 
{ 
    $vbulletin->options['selectednavtab']='UNIQUENAME'; 
    $tabselected = ' class="selected"'; 
}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="LINK TO YOUR SECTION">YOUR SECTION</a></li>' ;
now you just need to disable the highlighting on the home tab for your section of the CMS. This is done by editing the template vbcms_navbar_link, and making the <li class="selected"> near the top as conditional. Change the existing <li class="selected"> to:
Code:
<vb:if condition="$top_parent != YOUR SECTION ID">
<li class="selected">
<vb:else />
<li>
</vb:if>
You can of course do multiple sections in this way by editing that condition to include all the top level section ids (!= a AND != b AND !=c...) where you don't want the 'Home' tab selected.

The screenshot shows the Reviews section of my site, with the various subsections appearing in the submenu area. This tab remains highlighted throughout the Reviews section, subsections and articles.

Download

No files for download.

Screenshots

Click image for larger version
Name:	cms_section.png
Views:	1251
Size:	163.5 KB
ID:	127288  

Similar Mods

Mini Mods CMS - Sections menu navbar as pop-up vBulletin 4.x Template Modifications

vblts.ru supports vBulletin®, 2022-2024