View Full Version : [HOW TO - vB4] How add sub-menu drop down to the navbar (tab Forum)
Allan
01-07-2010, 10:00 PM
This mod add sub-menu drop down to the navbar (tab Forum)
PS: Thank to Lynne for his help :)
First Method
Add new plugin- Product -> vbulletin
- hook location -> process_templates_complete
- Title -> menu x
- Execution Order -> 5
- Plugin PHP Code
$template_hook['navbar_end'] .= '
<li class="popupmenu">
<a href="javascript://" class="popupctrl">Menu test</a>
<ul class="popupbody popuphover">
<li><a href="http://www.vbulletin-ressources.com/forum">test 1</a></li>
<li><a href="http://www.vbulletin-ressources.com/forum">test 2</a></li>
<li><a href="http://www.vbulletin-ressources.com/forum">test 3</a></li>
</ul> ';
Change location: ($template_hook['navbar_end'] in my example)
- navbar_end -> At the end to the navbar
- navbar_start -> At the beginning of the navbar
- navbar_after_getnew -> After "New Posts"
- navbar_after_pm -> After "Private Messages"
- navbar_after_faq -> After "Faq"
- navbar_after_calendar -> After "Calendar"
- navbar_after_community -> After "Community" button
Second method
In the "navbar" template, find:{vb:raw template_hook.navbar_end}
</ul>
</li>
<vb:elseif condition="$vboptions['selectednavtab']=='usercp'" />
Add above:<li class="popupmenu">
<a href="javascript://" class="popupctrl">Menu test</a>
<ul class="popupbody popuphover">
<li><a href="http://www.vbulletin-ressources.com/forum">test 1</a></li>
<li><a href="http://www.vbulletin-ressources.com/forum">test 2</a></li>
<li><a href="http://www.vbulletin-ressources.com/forum">test 3</a></li>
</ul>
</li>
Result:https://vborg.vbsupport.ru/external/2011/04/13.jpg
PS: Just change the links and titles.
Allan
01-09-2010, 06:12 PM
In public now.
KURTZ
01-09-2010, 06:19 PM
thanks for sharing Allan ;)
ShackMaster
01-13-2010, 06:33 PM
Can you help me with coding drop down tab menus for vB 3.8.4?
I am using additional CSS and placing the following code in the header,
<li id="current"><a href="#"><span>Tab 1</span></a></li>
<li><a href="#"><span>Tab 2</span></a></li>
<li><a href="#"><span>Tab 3</span></a></li>
<li><a href="#"><span>Tab 4</span></a></li>
<li><a href="#"><span>Tab 5</span></a></li>
<li><a href="#"><span>Tab 6</span></a></li>
<li><a href="#"><span>Tab 7</span></a></li>
but I have not been able to get the dropdown menus such as search and quick links to work.
Thanks!
ragtek
01-13-2010, 06:50 PM
Isn't this the same as https://vborg.vbsupport.ru/showthread.php?t=228338
Allan
01-13-2010, 06:56 PM
Isn't this the same as https://vborg.vbsupport.ru/showthread.php?t=228338
No, this article is for navbar, no navtab.
ShackMaster
01-13-2010, 07:13 PM
If you can help us code this... we are willing to pay.
We tried this hack (https://vborg.vbsupport.ru/showthread.php?t=200684&highlight=tabs), and everything works fine, other than getting dropdown menus to work with the tab list.
Is there a way to have this work on the CMS as well?
ahmedipa
01-24-2010, 07:01 AM
thank you for this very good
as7apcool
01-24-2010, 07:34 AM
thanks alot ... this is very useful
Desibabu19
02-15-2010, 12:16 PM
I installed this hack. It is great.
I am using a customised menu to search new posts in specific categories. - using this hack.
One problem I am facing is, after the execution of the search?.., the tab switches to "What's New ?" tab. Original search menu is under Forums, how to use this menu option but not switch the tab to What's New ?
Thanks in advance.
my forum : http://www.r2iclubforums.com/forums/
Forum Lover
03-03-2010, 12:47 PM
Hi, what if I just want a link there. I mean just like, new post, private messages faq or calender?
Thanks in advance. :)
Its possible a sub-sub-sub menu ? thanks
Paul B
03-06-2010, 08:38 PM
Also want to just make a single link in CMS area (home page).
Jaxel
03-29-2010, 02:55 AM
Okay... how would I ITERATE this?
For instance... this is my navtab template:
<vb:if condition="$vboptions['selectednavtab'] == 'media'">
<li class="selected">
<a class="navtab" href="media.php{vb:raw session.sessionurl_q}">Media</a>
<ul class="floatcontainer">
<li><a href="media.php{vb:raw session.sessionurl_q}">Media Home</a></li>
<li class="popupmenu">
<a href="javascript://" class="popupctrl">Categories</a>
<ul class="popupbody popuphover">
{vb:raw catbits}
</ul>
</li>
</ul>
</li>
<vb:else />
<li><a class="navtab" href="media.php{vb:raw session.sessionurl_q}">Media</a></li>
</vb:if>
You'll notice, instead of the actual subbits, I have a raw variable called "catbits". The code for getting the catbits would be as follows:
$categories = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "media_category");
while ($category = $vbulletin->db->fetch_array($categories))
{
$templater = vB_Template::create('media_NAVTAB_bit');
$templater->register('categoryID', $category['categoryID']);
$templater->register('catName', $category['catName']);
$catbits .= $templater->render();
}
Where would I put this code? And how do I register the $catbits variable into the hook?
--------------- Added 1269835210 at 1269835210 ---------------
Okay... trying things out, I was able to get it working by using this plugin....
if (THIS_SCRIPT == 'media')
{
$vbulletin->options['selectednavtab'] = 'media';
}
$categories = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "media_category");
while ($category = $vbulletin->db->fetch_array($categories))
{
$templater = vB_Template::create('media_NAVTAB_bit');
$templater->register('categoryID', $category['categoryID']);
$templater->register('catName', $category['catName']);
$catbits .= $templater->render();
}
$templater = vB_Template::create('media_NAVTAB');
$templater->register('catbits', $catbits);
$template_hook['navtab_middle'] .= $templater->render();
However, obviously this adds an extra query on EVERY page. Is there a better way to do this?
slimgamer
05-05-2010, 01:10 AM
thanks, trying it out now on our test server.
duckchief
05-13-2010, 08:30 AM
Hi, great tip to get a dropdown menu.
I implemented it and it appears in the Forum tab.
But now, I'd like to implement it in the CMS frontpage section.
Can you tell me how to do this?
Thanks!
g10net
05-15-2010, 02:43 PM
thank you
tcarr9
01-19-2011, 12:52 PM
Thank you SO much! I used option 1. Very easy mod to do, and easy to add as many links as I need.
Lostboyfan
04-05-2011, 01:10 AM
This is a great hack. Thank you. Btw is there a way to make it so members can only see it.
Da-Vinci
04-08-2011, 07:04 PM
Could anybody point me in the right direction of getting this effect?
https://vborg.vbsupport.ru/external/2011/04/17.jpg
Mustiii
04-27-2011, 02:33 PM
I addet this but the Problem is that it is shown if i click on the "Forum" Button. I addet a "Portal"-Button. How can i make that it appears there and not by the Forum Button?
https://vborg.vbsupport.ru/external/2011/04/10.png
Lynne
04-27-2011, 04:14 PM
This artilce is about adding the sub-menus, not the navtabs. You need to have the correct condition around your navtab to show it at the correct place. You should ask your question in the modification thread that you use for the navtab.
Mustiii
04-27-2011, 06:58 PM
But this has nothing to do with the modification, because i am sure many persons want to add sub-menus as example under the standard buttons like "whats new" and the "blog" and not only by the "forum" button so the question is how to specify that
Lynne
04-28-2011, 03:29 AM
And if you wrote the navtab correctly, then you would have the submenus showing. I have an article in my profile on how to correctly write a plugin to create a navtab with submenus.
Mustiii
04-28-2011, 02:39 PM
Thank you very much Lynne your article was the perfect description to solve my problem. Only thing i still need is to know how to translate (add Phrases) to this new buttons. Because i am using a multilingual Forum
Lynne
04-28-2011, 03:58 PM
Thank you very much Lynne your article was the perfect description to solve my problem. Only thing i still need is to know how to translate (add Phrases) to this new buttons. Because i am using a multilingual Forum
Instead of putting text for the links:
<a href="link.php">My Link</a>
Use phrases (you will need to enter them into the phrase manager as global phrases):
<a href="link.php">$vbphrase[my_link]</a>
Mustiii
04-28-2011, 04:43 PM
Thank you i addet all the submenus i needet. Only two are making me problems
1. The "Who's Online" Menu. I get this Error Message showing if i write it like that
Parse error: syntax error, unexpected T_STRING in /www/htdocs/w00d3776/vbulletin/includes/class_bootstrap.php(537) : eval()'d code on line 84
If i write it like Whos Online without ' it makes no problems but why cant i write it like in the Original way?
2. The "Open Contacts Popup"
If i add the code like this
<li><a onclick="window.open(getBaseUrl() + 'misc.php?do=buddylist&focus=1','buddylist','statu sbar=no,menubar=no,toolbar=no,scrollbars=yes,resiz able=yes,width=250,height=300'); return false;" href="javascript://">Open Contacts Popup</a></li>
i get this error message
Parse error: syntax error, unexpected T_STRING in /www/htdocs/w00d3776/vbulletin/includes/class_bootstrap.php(537) : eval()'d code on line 82
hope that a solution for this problems exists thanks for any help
Lynne
04-28-2011, 08:11 PM
If you are writing this in php output, you need to escape the character if that is what you have surrounding the output - \'
Mustiii
04-28-2011, 08:30 PM
I am not sure how to do that i think i can solve the first problem with writing Whos Online and add the correct writing to phrases but i am not sure how to change the Open contacts popup to make it work
--------------- Added 1304101672 at 1304101672 ---------------
Adding the phrases is making me problems i did it step by step but it looks like this now
https://vborg.vbsupport.ru/external/2011/04/3.png
https://vborg.vbsupport.ru/external/2011/04/4.png
https://vborg.vbsupport.ru/external/2011/04/5.png
8thos
06-23-2011, 09:55 PM
Thank you!
LordEd
06-27-2011, 07:12 PM
Hi, great tip to get a dropdown menu.
I implemented it and it appears in the Forum tab.
But now, I'd like to implement it in the CMS frontpage section.
Can you tell me how to do this?
Thanks!
https://vborg.vbsupport.ru/showthread.php?t=228338
I used that thread to do that.
bg-network
08-07-2011, 04:13 PM
Hi, I want to ask, how to make submenu in my Home tab?
Lynne
08-07-2011, 04:29 PM
Hi, I want to ask, how to make submenu in my Home tab?
Same way. Only find the template_hook names in the vbcms_navbar_link template.
bg-network
08-07-2011, 06:18 PM
Same way. Only find the template_hook names in the vbcms_navbar_link template.
Thank you, that's works.:up:
bg-network
08-08-2011, 06:44 PM
Excuse me for the stupid question, but how to add another drop-down menu next to the first one?
CouponWCents
10-18-2011, 11:36 AM
Thank you so much for this!! How do you make it visible only to a secondary usergroup?
grasshoper
01-17-2012, 05:18 PM
So this is not in 4.1.9? "process_templates_complete"
Lynne
01-17-2012, 10:57 PM
So this is not in 4.1.9? "process_templates_complete"
That hook location still exists.
tambo
02-14-2012, 05:02 PM
Is it possible with this hack (using the 2nd method Allan described) to create a second set of submenus that follow from the first? A bit like what was described in Post #21 (https://vborg.vbsupport.ru/showpost.php?p=2182394&postcount=21)?
I have a large number of links and it would be useful to use a categorised set of sub-menus.
06GTOAZ
02-15-2012, 04:37 AM
Thanks for posting up how to do this.
MacroPhotoPro
04-03-2012, 12:35 AM
Same way. Only find the template_hook names in the vbcms_navbar_link template.
How about just adding a single Navbar link to my Home/Forum/Blog Navbar (no submenus)?
What would be the correct coding for that?
Thanks!
rodeojones
04-25-2012, 07:29 PM
How about just adding a single Navbar link to my Home/Forum/Blog Navbar (no submenus)?
What would be the correct coding for that?
Thanks!
$template_hook['vbcms_navbar_end'] .= '<li><a href="Your Link">Link Title</a></li>';
That is what I used in order to get the link on my homepage.
I would also like to ask for insight as to how to set the link so that only users with permissions can see the link.
Lynne
04-25-2012, 08:34 PM
Put a condition around it.
if (is_member_of($vbulletin->userinfo, x, y, z) {
code
}
rodeojones
04-30-2012, 08:02 PM
Put a condition around it.
if (is_member_of($vbulletin->userinfo, x, y, z) {
code
}
Lynne, Thanks for the response. I used the following code in total and I didn't get a parsing error.
if (is_member_of($vbulletin->userinfo, Administrators)) {
$template_hook['vbcms_navbar_end'] .= '<li><a href="mylink">My Link</a></li>';
}
However, as the Admin I cannot see the link. Also, how would I add in usergroup names for permissions if the usergroup names have spaces in them?
Thanks again for your help :)
Lynne
04-30-2012, 09:33 PM
x,y, and z are the usergroupids, not usergroup names. Replace Administrator with the usergroupid of your Administrator usergroup.
rodeojones
05-01-2012, 01:21 PM
Excellent! Thanks again Lynne, it worked perfectly.
update 4.2.0 and not found please ...
tambo
10-31-2012, 11:27 AM
I'm wondering if anyone can advise on this?
VBulletin has special PHP variables that you can use in notices, such as {userid} and {username}, which will generate an output specific to the user.
I would like to use these variables in a search string (I know this works in notices) but, obviously, it doesn't work in these dropdowns because the search string is in javascript and won't be parsed (see example code below).
Is it somehow possible to get the special variable parsed server-side, then handed over to the javascript?
I've seen people talk about it, but nobody's provided a solution.
Thanks,
tambo
<li class="popupmenu">
<a href="javascript://" class="popupctrl">Menu test</a>
<ul class="popupbody popuphover">
<li><a href="http://www.example.com/search.php?do=process&query={username}">Test Search</a></li>
</ul>
</li>
Lynne
10-31-2012, 03:38 PM
The variable you would use would depend on the template you use it in. Most likely you would be wanting $bbuserinfo[username]
tambo
11-03-2012, 11:07 AM
haha... I'm afraid you might need to guide me a little more than that.
Is it possible to modify the code above so that I can understand where that variable would go and how it would be passed over to the javascript / hyperlink?
Lynne
11-03-2012, 04:41 PM
Try something more like:
http://www.example.com/search.php?do=process&query={vb:raw bbuserinfo.username}
tambo
11-05-2012, 06:46 PM
Ah, Lynne.... you absolute star!
Thankyou.
<3
Blue-Inc
05-01-2013, 06:35 PM
Where can I find the CSS for the drop down menu?
I'd like to customise the CSS to my own liking for my forum and add it to additional.css!
Thanks.
Jpolola
05-04-2013, 05:22 AM
I can`f find second method (navbar template on VB 4.2.0 PL3
<div id="navbar" class="navbar">
<ul id="navtabs" class="navtabs floatcontainer<vb:if condition="$show['member'] AND $notifications_total"> notify</vb:if>">
{vb:raw template_hook.navtab_start}
{vb:raw navigation}
{vb:raw template_hook.navtab_end}
</ul>
<vb:if condition="$vboptions['enablesearches']">
<div id="globalsearch" class="globalsearch">
<form action="search.php?{vb:raw session.sessionurl}do=process" method="post" id="navbar_search" class="navbar_search">
<vb:comment><input type="hidden" name="s" value="{vb:raw session.sessionurl}" /></vb:comment>
<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
<input type="hidden" name="do" value="process" />
<span class="textboxcontainer"><span><input type="text" value="" name="query" class="textbox" tabindex="99"/></span></span>
<span class="buttoncontainer"><span><input type="image" class="searchbutton" src="{vb:stylevar imgdir_button}/search<vb:if condition="$stylevar['textdirection'] == 'rtl'">_rtl</vb:if>.<vb:if condition="is_browser('ie') AND !is_browser('ie', 7)">gif<vb:else />png</vb:if>" name="submit" onclick="document.getElementById('navbar_search').submit;" tabindex="100"/></span></span>
</form>
<ul class="navbar_advanced_search">
<li><a href="search.php{vb:raw session.sessionurl_q}" accesskey="4">{vb:rawphrase advanced_search}</a></li>
{vb:raw template_hook.navbar_advanced_search}
</ul>
</div>
</vb:if>
</div>
</div><!-- closing div for above_body -->
<div class="body_wrapper">
<div id="breadcrumb" class="breadcrumb">
<ul class="floatcontainer">
<li class="navbithome"><a href="index.php{vb:raw session.sessionurl_q}" accesskey="1"><img src="{vb:stylevar imgdir_misc}/navbit-home.png" alt="{vb:rawphrase home}" /></a></li>
{vb:raw navbits.breadcrumb}
{vb:raw navbits.lastelement}
</ul>
<hr />
</div>
{vb:raw ad_location.ad_navbar_below}
{vb:raw ad_location.global_below_navbar}
<vb:if condition="$show['notices'] AND THIS_SCRIPT != 'register'">
<form action="profile.php?do=dismissnotice" method="post" id="notices" class="notices">
<input type="hidden" name="do" value="dismissnotice" />
<input type="hidden" name="s" value="{vb:raw session.sessionurl}" />
<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
<input type="hidden" id="dismiss_notice_hidden" name="dismiss_noticeid" value="" />
<input type="hidden" name="url" value="{vb:raw return_link}" />
<ol>
{vb:raw notices}
</ol>
</form>
</vb:if>
--------------- Added 1367648798 at 1367648798 ---------------
Any Idea how to add this code
<li class="popupmenu">
<a href="javascript://" class="popupctrl">Menu test</a>
<ul class="popupbody popuphover">
<li><a href="http://www.vbulletin-ressources.com/forum">test 1</a></li>
<li><a href="http://www.vbulletin-ressources.com/forum">test 2</a></li>
<li><a href="http://www.vbulletin-ressources.com/forum">test 3</a></li>
</ul>
</li>
StonePilot
04-30-2014, 07:43 PM
Seems people don't want to mess with updating this anymore.
Mega Menu? Nested dropdowns? Put a menu with links inside a menu?
Lynne
04-30-2014, 08:08 PM
Seems people don't want to mess with updating this anymore.
Mega Menu? Nested dropdowns? Put a menu with links inside a menu?
This article covers one thing - adding a sub-menu downdown to the navbar. There is nothing in the description that says anything about covers those other items.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.