vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   [HOW TO - vB4] How to Add Drop Down Navigation Items to the Navbar (https://vborg.vbsupport.ru/showthread.php?t=228338)

Shelby 11-18-2009 10:00 PM

[HOW TO - vB4] How to Add Drop Down Navigation Items to the Navbar
 
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>


Magz 11-18-2009 11:51 PM

Does what it says on the tin :)

Very simple, and effective

thanks

Parture 11-19-2009 12:37 AM

Works great. Is there a way to get the same background color as you have over it like the other buttons?

LoveStream 11-19-2009 01:48 AM

simple and great, thanks

taffy056 11-19-2009 09:23 AM

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

Zaiaku 11-20-2009 01:43 PM

Simple. Nice. Clean.

And the example screenshot. Priceless!

EidolonAH 11-21-2009 12:26 PM

Perfect, thank you Shelby.

steven s 11-23-2009 11:24 PM

Thank you.
Is there a way to choose where in the nav bar you want it located?

DesignWerks 11-25-2009 07:43 PM

Quote:

Originally Posted by 1996 328ti (Post 1919837)
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.

TandyServices 11-26-2009 01:36 PM

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.


All times are GMT. The time now is 08:45 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.01432 seconds
  • Memory Usage 1,750KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete