Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 4 Articles

Reply
 
Thread Tools
[HOW TO - vB4] How to Add Drop Down Navigation Items to the Navbar
Shelby
Join Date: Nov 2005
Posts: 67

 

Show Printable Version Email this Page Subscription
Shelby Shelby is offline 11-18-2009, 10:00 PM

Some people really like the drop down navigation that is found in the Vbulletin 3.0 series, or are looking to add additional drop down navigation to the navbar in Vbulletin 4.0. This plugin and new template will allow you to do that.


First, is to goto the Plugins and Products section, this section is in the left hand column of the admin panel near the bottom. In that section you will need to click the option to "Add New Plugin". Note that the red text from both the plugin and template must be the same. You can name it whatever you want, but they must match.

For the new plugin you will enter the following details.
Hook Location: process_templates_complete
Title: Whatever You Want
Code:
Code:
global $template_hook;
$newTemplate = vB_Template::create('dropdown');
$template_hook['navtab_end'] .= $newTemplate->render();
For step two. You need to make the template that will be used in the navbar. Simply goto the style manager and in choose "Add New Template" from the options. From there, you just need to enter the following.
Title: dropdown
Code:
Code:
<li class="popupmenu">
<a href="javascript://" class="popupctrl navtab" style="background:transparent url({vb:stylevar imgdir_misc}/arrow.png) no-repeat {vb:stylevar right} center; padding-right: 15px">Drop Bombs</a>
<ul class="popupbody popuphover">
<li><a style="text-indent: 0px; color:{vb:stylevar navbar_selected_popup_body_a_Color}" href="sublink1.php">SubLink 1</a></li>
<li><a style="color:{vb:stylevar navbar_selected_popup_body_a_Color}" href="sublink2.php">SubLink 2</a></li>
<li><a style="color:{vb:stylevar navbar_selected_popup_body_a_Color}" href="sublink3.php">SubLink 3</a></li>
</ul>
</li>
Reply With Quote
  #2  
Old 11-18-2009, 11:51 PM
Magz's Avatar
Magz Magz is offline
 
Join Date: Nov 2006
Location: UK
Posts: 147
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Does what it says on the tin

Very simple, and effective

thanks
Reply With Quote
  #3  
Old 11-19-2009, 12:37 AM
Parture Parture is offline
 
Join Date: Aug 2005
Posts: 237
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works great. Is there a way to get the same background color as you have over it like the other buttons?
Reply With Quote
  #4  
Old 11-19-2009, 01:48 AM
LoveStream LoveStream is offline
 
Join Date: Jan 2009
Posts: 77
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

simple and great, thanks
Reply With Quote
  #5  
Old 11-19-2009, 09:23 AM
taffy056 taffy056 is offline
 
Join Date: Sep 2004
Location: In a house in Wales ;)
Posts: 254
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Now that is great, I have finally a dropdown menu where I want it, thanks very much

--------------- Added [DATE]1258657656[/DATE] at [TIME]1258657656[/TIME] ---------------

Can I ask how would you set this so only certain usergroups would see the links, and the tabs?

Thanks
Reply With Quote
  #6  
Old 11-20-2009, 01:43 PM
Zaiaku's Avatar
Zaiaku Zaiaku is offline
 
Join Date: Jul 2007
Location: 3rd Level of Hell
Posts: 502
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Simple. Nice. Clean.

And the example screenshot. Priceless!
Reply With Quote
  #7  
Old 11-21-2009, 12:26 PM
EidolonAH EidolonAH is offline
 
Join Date: Apr 2009
Location: London, England
Posts: 178
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Perfect, thank you Shelby.
Reply With Quote
  #8  
Old 11-23-2009, 11:24 PM
steven s's Avatar
steven s steven s is offline
 
Join Date: Aug 2004
Location: Greenville, SC
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you.
Is there a way to choose where in the nav bar you want it located?
Reply With Quote
  #9  
Old 11-25-2009, 07:43 PM
DesignWerks DesignWerks is offline
 
Join Date: Apr 2009
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by 1996 328ti View Post
Thank you.
Is there a way to choose where in the nav bar you want it located?
Substituting 'navtab_middle' for 'navtab_end' places it after the Forum tab and before the Blogs tab.
Reply With Quote
  #10  
Old 11-26-2009, 01:36 PM
TandyServices's Avatar
TandyServices TandyServices is offline
 
Join Date: Aug 2008
Location: All over the USA
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have changed it up a few to open a new screen. Hope this helps a few.

Code:
<li class="popupmenu">
<a href="javascript://" class="popupctrl navtab" style="background:transparent url({vb:stylevar imgdir_misc}/arrow.png) no-repeat {vb:stylevar right} center; padding-right: 15px">vBulletin Sites</a>
<ul class="popupbody popuphover">
<li><a href="http://www.vbulletin.com" target="_blank" style="text-indent: 0px; color:{vb:stylevar navbar_selected_popup_body_a_Color}">vBulletin</a></li>
<li><a href="http://www.vbulletin.org" target="_blank" style="color:{vb:stylevar navbar_selected_popup_body_a_Color}">vBulletin.org</a></li>
<li><a href="http://www.vbulletin-germany.com/" target="_blank" style="color:{vb:stylevar navbar_selected_popup_body_a_Color}">vBulletin-Germany</a></li>
</ul>
</li>
To only let members see you could try:
Code:
<vb:if condition="!$show['guest']">
<li class="popupmenu">
<a href="javascript://" class="popupctrl navtab" style="background:transparent url({vb:stylevar imgdir_misc}/arrow.png) no-repeat {vb:stylevar right} center; padding-right: 15px">vBulletin Sites</a>
<ul class="popupbody popuphover">
<li><a href="http://www.vbulletin.com" target="_blank" style="text-indent: 0px; color:{vb:stylevar navbar_selected_popup_body_a_Color}">vBulletin</a></li>
<li><a href="http://www.vbulletin.org" target="_blank" style="color:{vb:stylevar navbar_selected_popup_body_a_Color}">vBulletin.org</a></li>
<li><a href="http://www.vbulletin-germany.com/" target="_blank" style="color:{vb:stylevar navbar_selected_popup_body_a_Color}">vBulletin-Germany</a></li>
</ul>
</li>
</vb:if>
I also found out that if you want two drop downs it worked for me like this:
Code:
<vb:if condition="!$show['guest']">
<li class="popupmenu">
<a href="javascript://" class="popupctrl navtab" style="background:transparent url({vb:stylevar imgdir_misc}/arrow.png) no-repeat {vb:stylevar right} center; padding-right: 15px">vBulletin Sites</a>
<ul class="popupbody popuphover">
<li><a href="http://www.vbulletin.com" target="_blank" style="text-indent: 0px; color:{vb:stylevar navbar_selected_popup_body_a_Color}">vBulletin</a></li>
<li><a href="http://www.vbulletin.org" target="_blank" style="color:{vb:stylevar navbar_selected_popup_body_a_Color}">vBulletin.org</a></li>
<li><a href="http://www.vbulletin-germany.com/" target="_blank" style="color:{vb:stylevar navbar_selected_popup_body_a_Color}">vBulletin-Germany</a></li>
</ul>
</li>
</vb:if>
 
<li class="popupmenu">
<a href="javascript://" class="popupctrl navtab" style="background:transparent url({vb:stylevar imgdir_misc}/arrow.png) no-repeat {vb:stylevar right} center; padding-right: 15px">vBulletin Sites 2</a>
<ul class="popupbody popuphover">
<li><a href="http://www.vbulletin.com" target="_blank" style="text-indent: 0px; color:{vb:stylevar navbar_selected_popup_body_a_Color}">vBulletin</a></li>
<li><a href="http://www.vbulletin.org" target="_blank" style="color:{vb:stylevar navbar_selected_popup_body_a_Color}">vBulletin.org</a></li>
<li><a href="http://www.vbulletin-germany.com/" target="_blank" style="color:{vb:stylevar navbar_selected_popup_body_a_Color}">vBulletin-Germany</a></li>
</ul>
</li>
Top one is hidden from guest. Then the other all can see.

Great code Shelby.Hope you don't mind but was just playing a bit with it and wanted to share.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:32 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05192 seconds
  • Memory Usage 2,321KB
  • Queries Executed 24 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (13)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete