![]() |
|
Article Options |
[HOW TO - vB4] Create a New Tab in the navbar
by
![]() Rating:
![]() 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.)
Things to take note of:
Your condition MUST be unique! If you use a condition that is also going to evaluate to true for another tab, then they will both be highlighted and the wrong submenu may show up underneath.
The 'seletednavtab' must also be a unique name. Again, if you have two tabs with the same 'selectednavtab' name, then both tabs will be highlighted.
You may use a different template_hook here - it just depends on where you want your tab to be - navtab_start and navtab_middle are also available. 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 The following members like this post: cherylferraro, rootsxrocks, Razorgod, K4GAP, Fuhrmann and 5 others.
Last edited by Lynne; 16 Jan 2011 at 19:59.. |
||||||||||||||||
Views: 110196
|
Comments |
#2
|
||||
|
||||
Thanks, Lynne! Good work, will come in handy!
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again. http://www.roma-antiqua.de No members have liked this post.
|
#3
|
|||
|
|||
What are we suppose to type in for THIS_SCRIPT? I tried "index".
I made link.php to read as index.php. What specifically are we suppose to put in for "unique_name"? Can we type anything like rabbit or dog? When I click on the forum logo the newly created Nav Link shows up with its menu and submenu now instead of the forum.php Forum tab and its menu. But when I click back on the Forum tab it does not highlight nor do its menu show up, but the newly created Nav Link with its menu remains highlighted. It gets even stranger. When I click on the Home tab it works, but then try to click back on the Nav Link it doesn't let me. And when I am in the Nav Link and click on the Nav Link it sends me to Home Tab with its menu. Help. No members have liked this post.
Last edited by Parture; 14 Nov 2009 at 21:32. |
#4
|
||||
|
||||
Hi Lynne,
I've copied the whole code and only changed link.php to another page, but it still does not 'select' itself on the navbar. I tried with a few unique names and such. No go. Here's the code I've tried.
Thanks again for all your help lately. Don't know what VB would do without ya ![]()
__________________
http://www.artoftravelblogging.com - A Travel Blogging Community No members have liked this post.
|
#5
|
||||||||||||
|
||||||||||||
Originally Posted by Parture
What is your goal here? When do you want this tab to be active? You want it active when a user is on the forum.php page (that one is defined as "index")? That will be a bit weird since you click the Forum tab and it goes to forum.php but you aren't going to have the Forum tab highlighted this way because the "index" page also the same as the the main entry page for you when the Forums link comes up active? If so, that condition may be a bit weird in which case you may want to change it to be something a bit more unique. So, first we need to define when you want that tab to be Active.![]()
Originally Posted by skylab
Same with you.... went do you want this tab to be Active? That is the condition you need to write. Most people want it active when they are on a specific page. At the top of that vbulletin page, THIS-SCRIPT is defined like this:![]()
In this case, your condition would be:
The condition does NOT have to be based on THIS_SCRIPT, but it DOES have to be UNIQUE to that tab.
__________________
Former vBulletin.org Staff Member
Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before. W3Schools - Online vBulletin Manual If I post some CSS and don't say where it goes, put it in the additional.css template. I will NOT help via PM (you will be directed to post in the forums for help.) No members have liked this post.
Last edited by Lynne; 14 Nov 2009 at 21:40. |
#6
|
|||
|
|||
Lynne,
Tell us what to type in for "yourpage", "unique_name", "link.php" so it works like a tab is suppose to work. When I click on my logo I want the Forum tab to start up as it does from the install of 4.0 and not go immediately to the Nav Link. Then I want to go to my Nav Link tab when I click on it with its menu without getting jumped around and without any of the above mentioned problems. No members have liked this post.
|
#7
|
||||
|
||||
What do you want on your navbar? Why are you adding a new tab? I can't tell you what to put there if I have no clue what it is for.
Right now, if you have 'index' in for 'yourpage' then yes, if you click on Forums it will highlight your new tab instead because your condition is true (you are on the forum.php page which is defined as THIS_SCRIPT == index). When do you want the Nav Link to be highlighted? It will be highlighted when $vbulletin->options['selectednavtab']='unique_name' and $vbulletin->options['selectednavtab']='unique_name' when THIS_SCRIPT == "yourpage".
__________________
Former vBulletin.org Staff Member
Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before. W3Schools - Online vBulletin Manual If I post some CSS and don't say where it goes, put it in the additional.css template. I will NOT help via PM (you will be directed to post in the forums for help.) No members have liked this post.
|
#8
|
|||
|
|||
I just want the Nav Link to work like you would expect it to work and with its menus of various external and internal links like I had with 3.8.4. Tell me what to fill in for "yourpage", "unique_name", "link.php" to able to make that happen.
No members have liked this post.
|
#9
|
|||
|
|||
Very useful indeed. Thank you.
No members have liked this post.
|
#10
|
||||
|
||||
Originally Posted by Parture
yourpage would be what THIS_SCRIPT is defined as at the top of the page you click on to make the navtab active![]()
unique_name is any unique word link.php is the page you wish the user to go to when they click the tab
__________________
Former vBulletin.org Staff Member
Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before. W3Schools - Online vBulletin Manual If I post some CSS and don't say where it goes, put it in the additional.css template. I will NOT help via PM (you will be directed to post in the forums for help.) No members have liked this post.
|
#11
|
|||
|
|||
I think what you are saying is that using that set of code you can't get the Nav Link with menus and submenues to work like I had it working with 3.8.4. I'll wait till someone figures something out.
No members have liked this post.
|
#12
|
||||
|
||||
I don't know if you can. I have no idea what you had working - you've supplied no details whatsoever on it (no details, no images, no anything).
__________________
Former vBulletin.org Staff Member
Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before. W3Schools - Online vBulletin Manual If I post some CSS and don't say where it goes, put it in the additional.css template. I will NOT help via PM (you will be directed to post in the forums for help.) No members have liked this post.
|
#13
|
|||
|
|||
Originally Posted by Lynne
In post #6 I said, "When I click on my logo I want the Forum tab to start up as it does from the install of 4.0 and not go immediately to the Nav Link. Then I want to go to my Nav Link tab when I click on it with its menu without getting jumped around and without any of the above mentioned problems."![]()
Basically, just like you would expect any link to work, with sublinks and drop down box, like the other tabs work. Pretty simple: able to put in whatever links I want. I have a feeling before 4.0 Gold comes out, they will provide this as an automated feature. It's a no brainer. No members have liked this post.
Last edited by Parture; 15 Nov 2009 at 18:15. |
#14
|
||||
|
||||
Originally Posted by Parture
And what is the link that your logo goes to? I have no clue. So, I can't suggest what to put in place of link.php, since you have't posted the link. I also can't suggest what to use for 'yourpage' since I don't know what page it is. I need *details*. If I only get general information from you, I can only give you general information back.
![]()
__________________
Former vBulletin.org Staff Member
Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before. W3Schools - Online vBulletin Manual If I post some CSS and don't say where it goes, put it in the additional.css template. I will NOT help via PM (you will be directed to post in the forums for help.) No members have liked this post.
|
#15
|
|||
|
|||
By clicking on the logo the basic navbar takes one to the forums page and highlights the forum tab. That's what I want, obviously. I don't want that to change. I don't want the Nav Link to be highlighted when I click on the logo which was happening with 'yourpage' as 'index' and 'link.php' as 'index.php'. I want to be able to add some external links and some internal links to the menu of Nav Link. I have no idea what to name 'yourpage' and 'link.php' for the Nav Link to work like any normal functioning tab with a drop down menu. When I click on the other existing tabs I don't want the Nav Link tab to be highlighted as the case is now. I don't want to get jumped to the Home tab by clicking on the Nav Link. By clicking on the Nav Link I want the menu to show up for the Nav Link. I want all existing tabs to work as they normally do and not be interferred with by the Nav Link, e.g. by clicking on the Forum tab, the Nav Link tab is highlighted with its menu.
Basically I want it to work like any link would work with its menu. Pretty simple. I just don't know what to put in for values for 'yourpage' and 'link.php' to make this happen or if it is even possible. For example, on your own site what would you put in for these values to make it work which I could try out also to see if it works for me too? If it doesn't work then it doesn't work. Need to try something else: rewrite the code. No members have liked this post.
Last edited by Parture; 15 Nov 2009 at 18:47. |
![]() |
«
Previous Article
|
Next Article
»
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Article Options | |
|
|
New To Site? | Need Help? |
All times are GMT. The time now is 00:39.