The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
[HOW TO - vB4] Create a New Tab in the navbar
Here's a pretty simple method for creating a new tab in the navbar, along with a submenu to go along with it. All you need is a unique condition for when your tab will be shown. What you will be making is a plugin to create the Nav Link along with a submenu which Link 1, Link 2, Link 3, and Drop Down which then drops down and has SubLink 1, SubLink 2, and SubLink 3. This is shown below. NOTE: This is for 4.0.x and 4.1.x. In 4.2.x, you should be using the Navigation Manager. This article is NOT to be used just to add another link to a submenu. It is for creating the Nav Link tab along with all the submenus. Again, if all you want is to add submenus to an existing tab, then this article is NOT for you!!! This article is also for use by users who understand the basics of conditions and can write them. The navbar is not really an easy thing to play with if you don't know what you are doing - I think even Wayne said it had issues - so don't try this if you don't understand how to write a condition. OK, with that out of the way.... Here's the basic template for making your new tab: Create a plugin (Plugins & Products) > Add New Plugin: hook location - process_templates_complete * Title - New Tab for Navbar Execution Order - 5 (* I used to have this listed as global_state_check but then noticed vb themselves use the process_templates_complete hook location, so I changed it.) PHP Code:
PHP Code:
PHP Code:
PHP Code:
ragtek also posted an article to do the same thing only using a template with the plugin - [HOW TO - vB4] Create a New Tab in the navbar (with template) Originally posted on vb.org 2009-10-27. Other related articles of possible interest: [HOW TO - vB4] Remove the vB Default Navtabs [HOW TO - vB4] Create your own vBulletin page |
#182
|
||||
|
||||
If you start a post in an article thread with this sentence, you can be sure that you are off topic. Because article threads are for what is discussed in the article. If you want to do something else, you need to open your own thread.
|
#183
|
|||
|
|||
Thanks very much for this (and your create own page tutorial) Lynne, your work is massively appreciated.
Can I be a pain and ask your advice? I am attempting to include two tabs on my test forum. One works fine, not a problem but the second tab doesn't remain highlighted once clicked. I've read through the thread and fiddled with it for over an hour, any possible chance you could have a look at my code and identify the problem? Working Tab; Code:
$tabselected = ''; $tablinks = ''; if (THIS_SCRIPT == 'newsfeed') { $vbulletin->options['selectednavtab']='newsfeed'; $tabselected = ' class="selected"'; $tablinks = ' <ul class="floatcontainer"> <li><a href="/testvb/newsfeed.php">Latest EFC News Feed</a></li> <li class="popupmenu"> <a href="javascript://" class="popupctrl">Events</a> <ul class="popupbody popuphover"> <li><a href="sublink1.php">Diary of Events</a></li> <li><a href="sublink2.php">Forthcoming Everton Events</a></li> <li><a href="sublink3.php">Official Facebook Events Group</a></li> </ul> </li> <li><a href="link2.php">Supporter Clubs</a></li> <li><a href="link3.php">Visitors Guide</a></li> </ul> '; } $template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="http://www.grandoldteam.com/testvb/newsfeed.php">News Feed</a>'.$tablinks.'</li>' ; Code:
$tabselected = ''; $tablinks = ''; if (THIS_SCRIPT == 'thesite') { $vbulletin->options['selectednavtab']='thesite'; $tabselected = ' class="selected"'; $tablinks = ' <ul class="floatcontainer"> <li><a href="/testvb/information.php">Link1</a></li> <li class="popupmenu"> <a href="javascript://" class="popupctrl">Events</a> <ul class="popupbody popuphover"> <li><a href="sublink1.php">Diary of Events</a></li> <li><a href="sublink2.php">Forthcoming Everton Events</a></li> <li><a href="sublink3.php">Official Facebook Events Group</a></li> </ul> </li> <li><a href="link2.php">Supporter Clubs</a></li> <li><a href="link3.php">Visitors Guide</a></li> </ul> '; } $template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="http://www.grandoldteam.com/testvb/newsfeed.php">The Site</a>'.$tablinks.'</li>' |
#184
|
||||
|
||||
Quote:
|
#185
|
|||
|
|||
Thanks but still having the same problem Lynne after changing the bottom link to a unique page.
|
#186
|
||||
|
||||
Quote:
PHP Code:
|
#187
|
|||
|
|||
Quote:
Thanks Lynne. All sorted now! |
#188
|
|||
|
|||
I just tried adding a new tab in navtab. I have suceeded adding a tab.
But I still have questions to get it working fully. So please help me out. I added a new tab called 'product' in navtab. Q1) Do I have to create a page for product as a php file? Q2) if so where do I upload the php file? which folder? Q3) After making the file and link it with the 'product'tab, would submenus show up? Currently 'product' tab is linked to index.php for testing purpose. Therefore it highlights 'home' tab and shows home's submenues. |
#189
|
||||
|
||||
Quote:
2) Wherever you said it was supposed to link to in your tab (same folder as other vbulletin files?) 3) Only if you write the condition correct about when to show the submenus and make the tab 'selected'. In my example, the condition is based about THIS_SCRIPT, so if you define THIS_SCRIPT in the products.php page, then use it in your condition like in the example. |
#190
|
|||
|
|||
Hey Lynne,
First off let me say that this guide has been incredibly helpful for me. I love being able to customize the tabs, and your instructions were easy enough to follow. I have a good amount of experience with VB, but I have hit a snag. I did some reading in this thread, some searching of this thread (as well as google) and still have not been able to find a solution to my problem. I am using VB 4.0.2 Suite with the CMS as the homepage. I have a number of different "Sections" set up in my CMS, and I would like each section to have its own button on the NavBar Tabs. This causes me problems because when I set it up so that a section (lets call it "Events") has its own button, even though I have set a custom THIS_SCRIPT setting for the plugin, the home button is still "selected" on the navbar. I believe this is because the "Events" page still is generated from the content.php file, and this is causing the problem with the THIS_SCRIPT setting, as they would be the same. Is my thinking correct? If so, is there anything I can do to work around this? Thanks in advance! |
#191
|
||||
|
||||
The conditions for showing the HOME tab to be 'selected' are in the plugin for the Home tab - Navbar: Insert CMS Navbar Entry. You would have to rewrite that condition so the tab is not selected when you want one of your other tabs to be selected.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|