Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Navbar Tabs for CMS Sections Details »»
Navbar Tabs for CMS Sections
Version: 1.00, by hqarrse hqarrse is offline
Developer Last Online: Dec 2014 Show Printable Version Email this Page

Category: Mini Mods - Version: 4.1.2 Rating:
Released: 03-06-2011 Last Update: Never Installs: 10
Uses Plugins Template Edits
 
No support by the author.

*********** obsolete from VB 4.2 - see my post #24 for the much better way of doing it using Andreas' extension to the new Nav Manager *************

The lack of ability to put links to CMS sections as tabs in the Navbar seems a bizarre oversight, however... solved to some extent although pretty clunky:

This will work if you are adding navbar tabs for a top level section, ie. one that is not a sub section of your CMS home. That tab will then become 'selected' for that section, subsections and articles. It can probably we adapted for other situations.

Anything in CAPS below needs to be filled in with your own values.

Firstly you need to get the top level section ID (we have sub sections so just the section id is not enough) as a variable available to the Navbar and vbcms_navbar_link templates. The only way I have found to get this is to take the first item in the breadcrumb array. The plugin to do this is:

Hook: vbcms_content_populate_start
Code:
global $bci;
$bci = $this->content->getBreadcrumbInfo();
vB_Template::preRegister('navbar',array('top_parent' => $bci[0]['nodeid']));
vB_Template::preRegister('vbcms_navbar_link',array('top_parent' => $bci[0]['nodeid']));
Now we need a new tab for our section. Creating a tab is described in various places on vb.org, but in a nutshell the plugin is:

location: process_templates_complete
Code:
global $bci;
$tabselected = ''; 
$tablinks = ''; 
if ($bci[0]['nodeid'] == YOUR SECTION ID) 
{ 
    $vbulletin->options['selectednavtab']='UNIQUENAME'; 
    $tabselected = ' class="selected"'; 
}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="LINK TO YOUR SECTION">YOUR SECTION</a></li>' ;
now you just need to disable the highlighting on the home tab for your section of the CMS. This is done by editing the template vbcms_navbar_link, and making the <li class="selected"> near the top as conditional. Change the existing <li class="selected"> to:
Code:
<vb:if condition="$top_parent != YOUR SECTION ID">
<li class="selected">
<vb:else />
<li>
</vb:if>
You can of course do multiple sections in this way by editing that condition to include all the top level section ids (!= a AND != b AND !=c...) where you don't want the 'Home' tab selected.

The screenshot shows the Reviews section of my site, with the various subsections appearing in the submenu area. This tab remains highlighted throughout the Reviews section, subsections and articles.

Screenshots

File Type: png cms_section.png (163.5 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 05-17-2011, 04:41 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You could easily make this in to a product for the plugins with the readme text file attached that explains the template edits.
Reply With Quote
  #13  
Old 05-18-2011, 02:50 AM
strudinox's Avatar
strudinox strudinox is offline
 
Join Date: Mar 2010
Location: California
Posts: 147
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for your help! Got it working perfectly! -Installed
Reply With Quote
  #14  
Old 05-18-2011, 10:10 AM
hqarrse hqarrse is offline
 
Join Date: Mar 2010
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo View Post
You could easily make this in to a product for the plugins with the readme text file attached that explains the template edits.
Too strapped for time at the moment to take this on, but I'll do that when I have a moment. You would hope that sooner or later this functionality would come as standard in VB as it seems such a basic, normal thing to want to do.
Reply With Quote
  #15  
Old 07-16-2011, 05:42 PM
anolian anolian is offline
 
Join Date: Jun 2011
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks so much hqarrse !!

I've been trying to figure out how to do this for ages, and that solves the problem completely! This woud make a fantastic and surely very popular mod - I'd vote it as MOTM definitely.

Yes, it is a bit clunky - but easy to do and solves a really important requirement simply and effectively. Very cool.

Thanks again.
Reply With Quote
  #16  
Old 08-07-2011, 04:50 PM
mikeinjersey mikeinjersey is offline
 
Join Date: Feb 2006
Posts: 290
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

quick question so I don't screw this up.

Quote:
YOUR SECTION ID
is just looking for a number and nothing else, right ? like 15 ?

Also, I have sub-Sections under my main Sections. (not categories) If I do one of the main Sections, will the sub-sections display automatically just underneath ?

for example : I have PS3 as a main section... and PS3 previews as the sub-section just underneath it.

thx much in advance
Reply With Quote
  #17  
Old 08-07-2011, 05:52 PM
hqarrse hqarrse is offline
 
Join Date: Mar 2010
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi, yes you need the section ID number, and yes you will see your sub-sections. See my screenshot.
Reply With Quote
  #18  
Old 08-12-2011, 08:03 PM
archet1337's Avatar
archet1337 archet1337 is offline
 
Join Date: Sep 2009
Location: Norway
Posts: 251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is very nice. Any chance of getting the mod as a XML product?
Reply With Quote
  #19  
Old 08-15-2011, 07:36 AM
hqarrse hqarrse is offline
 
Join Date: Mar 2010
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not from me in the near future, sorry. I just don't have the time to take it on. Also you would hope that VB will enable you to do this at some point soon, so this will hopefully become an obsolete hack.
Reply With Quote
  #20  
Old 09-15-2011, 06:25 PM
lild100 lild100 is offline
 
Join Date: Oct 2010
Posts: 86
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey looks great!

To explain what I need Ill use your screen shot as an example.

If you see the nav tab 'games reviews'... If you was to put a article in there.... would the article also be displayed in the book reviews... if book reviews was called home tab.

So the home tab collects all the latest articles in each selected nav tab..

If this mod doesn't do you know how this can be done?

Thanks

Dan
Reply With Quote
  #21  
Old 09-15-2011, 06:47 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by lild100 View Post
Hey looks great!

To explain what I need Ill use your screen shot as an example.

If you see the nav tab 'games reviews'... If you was to put a article in there.... would the article also be displayed in the book reviews... if book reviews was called home tab.

So the home tab collects all the latest articles in each selected nav tab..

If this mod doesn't do you know how this can be done?

Thanks

Dan
Good luck!
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 01:16 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04350 seconds
  • Memory Usage 2,329KB
  • 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_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (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
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete