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 |
#42
|
||||
|
||||
I added a bit more to the first post including the part about going to the Plugin Manager. However, this article really isn't for the total novice. You need to understand what a condition is and be able to write one.
|
#43
|
|||
|
|||
I looked but did not find the answer. How do you add a phrase in this code for Sublink 1?
<li><a href="sublink1.php">SubLink 1</a></li> I tried ' . $vbphrase['my_phrase'] .' I tried {vb:rawphrase my_phrase} never mind ... I needed to globalize it |
#44
|
|||
|
|||
What ever level we understand coding Lynne should not matter, I accept my understanding of coding needs improvement, but that's not the point. We are trying to get our heads around vB4, which is no walk in the park and we look to people like yourself for help. You do a fantastic amount of good here and I personally truly appreciate that, but clear and straight forward guides help more than being told we lack understanding.
To cellarius, I apologise, I find myself enduring a great deal of keyboard warriors here and there and I mistook your post as yet another jibe from another coward hiding behind a keyboard. Didn't mean to be offensive and I am sorry for offending you. |
#45
|
||||
|
||||
Neither did I want to mock you or anything, sorry for perhaps coming off like that - so, we're good here
Anyway, I really see where you are coming from, I learned a lot from tutorials like this very one. I understand what you mean, but it is always about finding a middle way in texts like this. There's some basics you need to build upon if you want to do some in-depth explaining, or the tutorials would get overly complex. There's other articles about the plugin system, and even a section in the manual. If one had to explain that every time again, the articles would be cluttered. Finding this middle way is not always easy, tho, and you won't be able to need everyones needs |
#46
|
|||
|
|||
How can we change the display order of the navbar. Meaning put new items(per this tutorial), so that they show between "blogs" and "whats new"
|
#47
|
||||
|
||||
Quote:
|
#48
|
|||
|
|||
Lynne,
Thanks for this awesome guide. So I'm trying to hide the tab from people not logged in. Also I only want some user groups to see it. This is what I have so far. PHP Code:
--------------- Added [DATE]1258564039[/DATE] at [TIME]1258564039[/TIME] --------------- Woot I just fixed it. I put the if statement above the global and it works. Doesn't matter about the member part now. Because if they are not part of the right group it won't even show up. :-) So here is my answer: PHP Code:
|
#49
|
||||
|
||||
You really should have { and } around the whole thing after your if is_member_of statement. Right now, you are basically just saying if is_member_of then make the $template_hook global, which is needed right now for this plugin to work. If they fix the issue of the $template_hook not being global, then suddenly your plugin isn't going to work because it will be made global elsewhere and therefore work.
|
#50
|
|||
|
|||
Ok so something like this?
PHP Code:
|
#51
|
||||
|
||||
Yes, that looks correct - you have the content of the whole plugin in the condition now.
Hello Kallell! Now I recognize you. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|