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 |
#402
|
||||
|
||||
You would need to write some condition that is unique to whatever "Listings" is. I don't know anything about that page since it isn't a default vb page (or is it and you are just calling it something else?), so I don't know what the condition would be. If it's a custom page, then define THIS_SCRIPT at the top of the php page, like it is defined on other vB pages, and then you can use that in the condition.
|
#403
|
||||
|
||||
Lynne,
Please be gentle with me on this...I've looked over your instructions...and I'm sitting here scratching my head. I have a mod installed called Chatbox Evo. There is no option in this mod to add a link to the navbar, or to the community link menu. I want to add a new tab on the navbar that opens the chatbox in full-page mode. I want to name this tab "Chat"...and it will be viewable by all who visit the site. The link to call the full-size chatbox is as follows: Code:
http://www.glitchpcforums.com/forum/mgc_cb_evo.php?do=view_chatbox |
#404
|
||||
|
||||
Not really. I don't know anything about the code for that mod. You may want to ask the developer if there is a THIS_SCRIPT set on that page that you can use in the condition. Then you could do something like:
PHP Code:
|
#405
|
||||
|
||||
Quote:
Thank you for the reply... Yes, there is a THIS_SCRIPT set on the page: Code:
define('THIS_SCRIPT', 'mgc_cb_evo'); Can you provide me with the code, or the modifications from your code...in order for me to complete this? I don't want to remove any lines of code from what you have given us...and leave myself hanging. I do understand coding...a little, but don't want to leave myself in a bind. Thanks, in advance... |
#406
|
|||
|
|||
This is PERFECT for creating only a TAB, this is what I was looking for.
Quote:
|
#407
|
||||
|
||||
Update...
Got 'er done! Thanks for the help...much appreciated. |
#408
|
||||
|
||||
Tell me, how did you do it? I'd like to do the same
|
#409
|
|||
|
|||
Hi Lynne, I've read through a few of the posts here regarding having the forum tab highlighted along with the new tab. I added the tab fine, I'm using a UserCP tab, but the forum tab is highlighted when I click it.
Here's my plugin code Code:
if (THIS_SCRIPT == 'UserCP') // also defined('UserCP') possible
{
//set selected tab
$vbulletin->options['selectednavtab'] = 'UserCP';
}
// add the "subtemplate" to the navbartemplate
$template_hook['navtab_end'] .= vB_Template::create('UserCP Nav Bar')->render();
|
#410
|
||||
|
||||
There is not default vbulletin script named "UserCP", so is this on a custom page? And, you cannot have a template called "UserCP Nav Bar" - you may not have spaces in a template name.
I really don't get what you are doing with your plugin code at all and I don't see the tab code in there either. |
#411
|
|||
|
|||
This is working just fine for me, and (as usual!) thank you, Lynne.
One quick question, here's my code - I'm just adding a link to vaispy. Everything works as it should, and I just removed the default dropdown menus from your code. Code:
$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'vaispy')
{
$vbulletin->options['selectednavtab']='mgtab_forumspy';
$tabselected = ' class="selected"';
$tablinks = '';
}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="(my test tld)forum/vaispy.php">ForumSpy</a>'.$tablinks.'</li>' ;
Thanks! |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|