Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 4 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
[HOW TO - vB4] How add sub-menu drop down to the navbar (tab Forum)
Allan's Avatar
Allan
Join Date: Jun 2003
Posts: 1,513

 

France
Show Printable Version Email this Page Subscription
Allan Allan is offline 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

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:
PHP Code:
{vb:raw template_hook.navbar_end}
                </
ul>
            </
li>
        <
vb:elseif condition="$vboptions['selectednavtab']=='usercp'" /> 
  • Add above:
PHP 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
  • Result:


PS: Just change the links and titles.
Attached Images
File Type: jpg menu.jpg (16.3 KB, 0 views)
Reply With Quote
  #12  
Old 02-15-2010, 12:16 PM
Desibabu19 Desibabu19 is offline
 
Join Date: Jan 2007
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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/
Reply With Quote
  #13  
Old 03-03-2010, 12:47 PM
Forum Lover Forum Lover is offline
 
Join Date: Jun 2007
Location: Sydney
Posts: 503
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi, what if I just want a link there. I mean just like, new post, private messages faq or calender?

Thanks in advance.
Reply With Quote
  #14  
Old 03-04-2010, 02:32 PM
xony xony is offline
 
Join Date: Mar 2005
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Its possible a sub-sub-sub menu ? thanks
Reply With Quote
  #15  
Old 03-06-2010, 08:38 PM
Paul B Paul B is offline
 
Join Date: Mar 2010
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Also want to just make a single link in CMS area (home page).
Reply With Quote
  #16  
Old 03-29-2010, 02:55 AM
Jaxel Jaxel is offline
 
Join Date: Sep 2005
Posts: 1,160
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay... how would I ITERATE this?

For instance... this is my navtab template:
Code:
<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:
Code:
$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 [DATE]1269835210[/DATE] at [TIME]1269835210[/TIME] ---------------

Okay... trying things out, I was able to get it working by using this plugin....

Code:
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?
Reply With Quote
  #17  
Old 05-05-2010, 01:10 AM
slimgamer's Avatar
slimgamer slimgamer is offline
 
Join Date: Apr 2010
Location: HI
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks, trying it out now on our test server.
Reply With Quote
  #18  
Old 05-13-2010, 08:30 AM
duckchief duckchief is offline
 
Join Date: May 2010
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #19  
Old 05-15-2010, 02:43 PM
g10net g10net is offline
 
Join Date: Jan 2010
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thank you
Reply With Quote
  #20  
Old 01-19-2011, 12:52 PM
tcarr9 tcarr9 is offline
 
Join Date: Jul 2010
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you SO much! I used option 1. Very easy mod to do, and easy to add as many links as I need.
Reply With Quote
  #21  
Old 04-05-2011, 01:10 AM
Lostboyfan's Avatar
Lostboyfan Lostboyfan is offline
 
Join Date: Mar 2010
Location: Chicago, IL
Posts: 73
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is a great hack. Thank you. Btw is there a way to make it so members can only see it.
Reply With Quote
Reply


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:26 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.05427 seconds
  • Memory Usage 2,331KB
  • Queries Executed 26 (?)
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
  • (3)bbcode_code
  • (3)bbcode_php
  • (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
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (2)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)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_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete