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 |
#62
|
|||
|
|||
Thanks for the quick reply... Great article. In the attachment you can see that I have it working. What I am looking to do is add a sub menu to the sub menu. I have the Tech Area tab then the sub menu that has Carbs trying to add a sub menu to carbs so it will have Cleaning link and Jetting link. So basically making when you click on carbs it does not take you to Carbs.php but opens a sub menu that would have links to jetting.php and Cleaning.php
Thanks Eric PHP Code:
|
#63
|
||||
|
||||
I don't know how to add a submenu to a submenu as I haven't tried to do that. You'll have to play with the css to do that.
|
#64
|
||||
|
||||
Is there any way to use vb if statements with this mod?
I tried wrapping certain links under the custom tab in the Code:
<vb:if condition="$show['modcplink']"> *stuff here* </vb:if> but it completely breaks this plugin, you get a Quote:
Does perhaps some other function have to be called in either this or the .php page in question? (I'm using the custom php page Lynne posted an article on in conjunction with this plugin) the same vb if statement works if I put it elsewhere within a template that apears on the page, but I would like the link in question to be in the navbar and not in the body. |
#65
|
||||
|
||||
This post shows how to use conditions to add the links - https://vborg.vbsupport.ru/showpost....6&postcount=28 See if that helps.
|
#66
|
||||
|
||||
I actualy tried that way of doing it too, what happens if with is, the if conditional just gets put in the navbar as plain text, as if vb is not seeing it as a conditional. I notice the syntax highlighting on the plug code input page also doesn't color the extra if statement in green like the if statement at the top for the 'this_script ==' one.
Here's my complete code for the navtab plugin: Code:
$tabselected = ''; $tablinks = ''; if (THIS_SCRIPT == 'dkp.php') { $vbulletin->options['selectednavtab']='dkp_listmembers'; $tabselected = ' class="selected"'; $tablinks = ' <ul class="floatcontainer"> <li class="popupmenu"> <a href="javascript://" class="popupctrl">Administration</a> <ul class="popupbody popuphover"> if (is_member_of($vbulletin->userinfo, 5, 6, 13, 14)) { <li><a href="/25manwrathplus/admin/" target=dkp_frame>Eqdkp Admin Index</a></li> <li><a href="/25manwrathplus/plugins/ctrt/" target=dkp_frame>Import CTRA String</a></li> <li><a href="/25manwrathplus/admin/addiadj.php" target=dkp_frame>Do Adjustments</a></li> } </ul> </li> <li><a href="/25manwrathplus/listmembers.php?s=" target=dkp_frame>Standings</a></li> <li><a href="/25manwrathplus/listraids.php?s=" target=dkp_frame>Raids</a></li> <li><a href="/25manwrathplus/listevents.php?s=" target=dkp_frame>Events</a></li> <li><a href="/25manwrathplus/listitems.php?s=" target=dkp_frame>items</a></li> <li><a href="/25manwrathplus/listitems.php?s=&p=history" target=dkp_frame>History</a></li> <li><a href="/25manwrathplus/stats.php?s=" target=dkp_frame>Stats</a></li> <li><a href="/25manwrathplus/plugins/raidplan/listraids.php?s=" target=dkp_frame>Raid Planner</a></li> <li><a href="/25manwrathplus/plugins/raidplan/raidstats.php?s=" target=dkp_frame>Raid Planner Stats</a></li> <li class="popupmenu"> <a href="javascript://" class="popupctrl">Your DKP Account</a> <ul class="popupbody popuphover"> <li><a href="/25manwrathplus/settings.php?mode=account" target=dkp_frame>Account Settings</a></li> <li><a href="/25manwrathplus/plugins/raidplan/usersettings.php" target=dkp_frame>Raid Planner Settings</a></li> <li><a href="/25manwrathplus/login.php?logout=true" target=dkp_frame>Log Out of Eqdkp</a></li> <li><a href="/25manwrathplus/login.php" target=dkp_frame>Log Into Eqdkp</a></li> </ul> </li> </ul> '; } $template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="dkp.php">DKP</a>'.$tablinks.'</li>' ; Only difference I can see in the example you gave and my version, is I'm trying to hide an entire popup control to non admins, your example just tries to hide a link. |
#67
|
||||
|
||||
I'd suggest you start over with the plugin because you've totally messed up the structure of the submenu.
The reason why you are ending up with the condition showing up in the code is because you are putting it there. Look again at the code I wrote. You need to *end* your writing to the variable $tablinks, then do the condition and add to $tablinks if the condition is true, and then continue writing to it later on. But, you need to break out of writing to it in order to do the condition - you just put the condition right in the middle of it! Basically: PHP Code:
|
#68
|
||||
|
||||
Quote:
Quote:
Thanks again. |
#69
|
||||
|
||||
Maybe I did something weird on my end, but when I tried it, it did some wacky things.
|
#70
|
|||
|
|||
I did everything you said in the first post, and it works perfectly. There is only one thing I can't figure out.
If I click the links below the button, link1.php for example, it doesn't keep that button selected. It highlights the forum button again. Is there anyway I can put multiple "yourpage" names in that code so it keeps the button highlighted even when going to a page by clicking a link below the button? if (THIS_SCRIPT == 'yourpage') --------------- Added [DATE]1259795597[/DATE] at [TIME]1259795597[/TIME] --------------- NVM fixed it |
#71
|
|||
|
|||
I fixed the first issue I had, but I have another question. In my images you can see what I mean.
I want the second image, the affiliate one, to show home in front of it as well. Just like in the first image. How can I change that? Like it says: Home > Frontpage And the other one only says: Affiliates |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|