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

Reply
 
Thread Tools
NAVTAB Combo Drop-Menu with Sub-Items
cory_booth
Join Date: Jul 2006
Posts: 224

 

Show Printable Version Email this Page Subscription
cory_booth cory_booth is offline 01-13-2010, 10:00 PM

I have seen several hack to add a NAVTAB menu item (we are talking about the main links).
However, I had not ran across anything that would do exactly what I wanted.

Here is what this does.
Say you have a few pages you want a drop-down link (from the NAVTAB).
For example, I have an add-on gallery.
I wanted a single NAVTAB button called "GALLERY" but a drop-down to select the add on or VB Albums.

There is documentation to cover that, however...
Once the user clicks the drop-down menu, the NAVTAB "GALLERY" button is no longer "selected" and you do not have those nice sub-menu items.

This little combo hack will do this.

First, you must know the THIS_SCRIPT for the pages you will load with the drop-menu.

Once you know this, you can add them to the THIS_SCRIPT area and do two comparisons.
If you are not on one of the THIS_SCRIPT pages, the NAVTAB will be a drop-down.
If you are on one of the THIS_SCRIPT pages, the NAVTAB will be a selected link with submenu items.

Make a new plugin and add this code.


Code:
global $template_hook;
$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'DROP Page 1' || THIS_SCRIPT == 'Drop PAGE 2')
{
    $vbulletin->options['selectednavtab']='droppage';
    $tabselected = ' class="selected"';
    $tablinks = '    
                       <ul class="floatcontainer">
                        <li><a href="Sublink1.php">Sublink 1</a></li>
                        <li><a href="Sublink2.php">Sublink 2</a></li>
                        <li><a href="Sublink3.php">Sublink 3</a></li>
                        <li><a href="Sublink4.php">Sublink 4</a></li>';
		</ul>';
$template_hook['navtab_middle'] .= '<li'.$tabselected.'><a class="navtab" href="MainPage.php">Drop Links</a>'.$tablinks.'</li>';
} 
else
{
$template_hook['navtab_middle'] .= '
<li class="popupmenu">
<a  href="javascript://" class="selected popupctrl navtab">Drop Links</a>
<ul class="popupbody popuphover">
<li><a rel="album" href="droplink1.php">Drop Link 1</a></li>
<li><a rel="gallery" href="droplink2.php">Drop Link 2</a></li>
</ul></li>';
}
Attached Images
File Type: jpg drop.JPG (10.0 KB, 0 views)
File Type: jpg drop2.JPG (8.0 KB, 0 views)
Reply With Quote
  #2  
Old 06-02-2010, 09:32 PM
Fuhrmann Fuhrmann is offline
 
Join Date: May 2010
Posts: 76
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice Article. I get this error:

"Parse error: syntax error, unexpected '<' in /home/combatar/public_html/pfps/includes/class_bootstrap.php(509) : eval()'d code on line 52"

I will look what it is...
Reply With Quote
  #3  
Old 06-09-2010, 05:32 AM
as7apcool as7apcool is offline
 
Join Date: Feb 2009
Posts: 194
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks alot 4 your work
Reply With Quote
  #4  
Old 06-10-2010, 07:00 PM
Front Range Front Range is offline
 
Join Date: Apr 2008
Posts: 111
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Cory, very nice write-up! I now have 6 category drop-downs with 5 or so drop menus. :up:
Reply With Quote
  #5  
Old 06-12-2010, 06:56 AM
Skyborg Skyborg is offline
 
Join Date: Jul 2009
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

if i would like to create a plugin.
I need to choose "Add-on" and "Hook".

Can somebody tell me what to choose?

Thank you.

Skyborg
Reply With Quote
  #6  
Old 09-24-2010, 10:26 AM
FCS-Webmaster FCS-Webmaster is offline
 
Join Date: Aug 2007
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Don't work with 4.0.7.

I tried to implement that code but only get an error:
Parse error: syntax error, unexpected '<' in wholeserverpath/home/includes/class_bootstrap.php(517) : eval()'d code on line

Okay it seems to be that you have an error in your syntax

PHP Code:
global $template_hook;
$tabselected '';
$tablinks '';
if (
THIS_SCRIPT == 'DROP Page 1' || THIS_SCRIPT == 'Drop PAGE 2')
{
    
$vbulletin->options['selectednavtab']='droppage';
    
$tabselected ' class="selected"';
    
$tablinks '    
                       <ul class="floatcontainer">
                        <li><a href="Sublink1.php">Sublink 1</a></li>
                        <li><a href="Sublink2.php">Sublink 2</a></li>
                        <li><a href="Sublink3.php">Sublink 3</a></li>
                        <li><a href="Sublink4.php">Sublink 4</a></li>'
; <--- this has to be erased ';
        </ul>'
; <--- Cause here its the end 
And for some reason I don't why the submenu shows not right
Reply With Quote
  #7  
Old 09-30-2010, 01:18 AM
ozzy47's Avatar
ozzy47 ozzy47 is offline
 
Join Date: Jul 2009
Location: USA
Posts: 10,929
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I use the following hack and it works great.

https://vborg.vbsupport.ru/showthread.php?t=233629
Reply With Quote
  #8  
Old 10-01-2010, 02:38 AM
ssslippy ssslippy is offline
 
Join Date: Jan 2006
Posts: 877
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This should be cleaner code no reason for an else in there.

Code:
$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'script1' OR THIS_SCRIPT == 'script2')
{
    $vbulletin->options['selectednavtab']='unique_name';
    $tabselected = ' class="selected"';
        $tablinks = '<ul class="floatcontainer">
                                    <li><a href="link1.php">Link 1</a></li>
                                    <li><a href="link2.php">Link 2</a></li>
                                 </ul> ';
} 
$template_hook['navtab_middle'] .= '
<li '.$tabselected.' class="popupmenu">
<a href="javascript://" class="popupctrl navtab">Members</a>
<ul class="popupbody popuphover">
<li><a style="text-indent: 0px; color:#000000" href="link1.php">Link 1</a></li>
<li><a style="color:#000000" href="link2.php">Link 2</a></li>
</ul>
'.$tablinks.'</li>
';
Reply With Quote
  #9  
Old 12-14-2010, 09:38 PM
sailnet sailnet is offline
 
Join Date: Oct 2009
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'd like to use this mod but I am very confused as to the definition of this_script.

does this_script refer to page name such as forum.php, forumdisplay.php, showthread.php, etc?

is that what it means?

I'd like to use the tabbed menu built into vb4 because I'm currently using a commercial product in my vb3.8 install.

please help me understand.
Reply With Quote
  #10  
Old 11-20-2013, 08:03 AM
craigvm's Avatar
craigvm craigvm is offline
 
Join Date: Aug 2012
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ozzy47 View Post
I use the following hack and it works great.

https://vborg.vbsupport.ru/showthread.php?t=233629
thanks just installed this and it works great
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 10:18 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.04621 seconds
  • Memory Usage 2,313KB
  • 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
  • (2)bbcode_code
  • (1)bbcode_php
  • (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
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (2)postbit_attachment
  • (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_postinfo_query
  • fetch_postinfo
  • 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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete