Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-30-2012, 03:48 AM
Aaron310012 Aaron310012 is offline
 
Join Date: Jan 2012
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Navbar Tab Addition for CMS Sections - Highlighting

Hello,

I have created several new Navbar tabs linking to different CMS sections using the solution found here:

https://vborg.vbsupport.ru/showthread.php?t=226914

The tabs work great, but do not highlight when selected. Instead, "Home" remains highlighted.

I've been working with this for a while without any luck. I understand that I must define a condition for the highlighting to work but since these are all CMS section pages THIS_SCRIPT always = 'vbcms' for all of the section pages, so this is not a unique condition. I have also tried to define the URL several different ways using both standard URLs and Friendly URLs without success.

Here is an example of the plugin code I'm trying to use for a "Contact" tab:

$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'Contact')
{
$vbulletin->options['selectednavtab']='Contact';
$tabselected = ' class="content"';
}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab"

href="content.php/102-Contact">Contact</a>'.$tablinks.'</li>' ;


I have also tried to define "THIS_SCRIPT ==" as all variants of the actual URL as well as R= etc.

Does anyone happen to have any advice regarding the proper way to define a unique variable for the section pages of the CMS? Thanks in advance for any input!
Reply With Quote
  #2  
Old 01-30-2012, 09:32 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to change the condition for highlighting the Home tab (in the vBulletin CMS product - Navbar: Insert CMS Navbar Entry plugin) to exclude highlighting it under the conditions you want the other tabs to show as highlighted.
Reply With Quote
  #3  
Old 02-02-2012, 02:55 AM
Aaron310012 Aaron310012 is offline
 
Join Date: Jan 2012
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello and thanks for the reply!

Could you please give an example of how to access the URL (or RELPATH) from within the plugin? That is the only condition that I can find that differs among the Home tab & the other tabs that I have created. When I attempt it now, the value of RELPATH is blank, so there is no condition that is true on the created tabs but not the Home.

Any help or ideas you give would be greatly appreciated.
Reply With Quote
  #4  
Old 02-02-2012, 06:44 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is not valid for a content.php page:
PHP Code:
if (THIS_SCRIPT == 'Contact'
So, once you find a valid condition, then you will be able to add it to the other condition. It would use $_GET['r'] in the condition.
Reply With Quote
  #5  
Old 02-07-2012, 03:17 AM
Aaron310012 Aaron310012 is offline
 
Join Date: Jan 2012
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Lynne,

I used $_GET['r'] as the unique condition, combined with the Navbar: Insert CMS Navbar Entry suggestion, and everything is working perfectly.

Thanks so much for your help; I really appreciate it!

Aaron
Reply With Quote
  #6  
Old 02-08-2012, 12:51 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Glad you got it working.
Reply With Quote
  #7  
Old 05-08-2012, 02:10 PM
MajinOLesedi MajinOLesedi is offline
 
Join Date: Jul 2011
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Aaron310012 View Post
Lynne,

I used $_GET['r'] as the unique condition, combined with the Navbar: Insert CMS Navbar Entry suggestion, and everything is working perfectly.

Thanks so much for your help; I really appreciate it!

Aaron
Hello, lol Can you tell me how managed this. Im not too familiar with php yet. Im at the same problem you had. Can you post the code?
Reply With Quote
  #8  
Old 05-08-2012, 03:37 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you click to view a page in the CMS and look at the URL, you will see something like "r=1-the-front-page". The $_GET['r'] variable is "1-the-front-page". Although it's easier to use intval and just use the number. So, a condition could be:

PHP Code:
if (intval($_GET['r']) == x) {
code

Reply With Quote
  #9  
Old 05-08-2012, 06:36 PM
MajinOLesedi MajinOLesedi is offline
 
Join Date: Jul 2011
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok I get it now but im not too familiar on how I can execute the code that will un-highlight the Home Tab if Im on the News Tab.

This is my custom New Tab plugin
PHP Code:
$tabselected ''
$tablinks ''
if (
intval($_GET['r'])) 

    
$vbulletin->options['selectednavtab']='News'
    
$tabselected ' class="selected"'
    
$tablinks '                <ul class="floatcontainer"> 
                        <li><a href="/content.php?5-News">Doc</a></li>
                        <li><a href="link2.php">Link 2</a></li> 
                        <li><a href="link3.php">Link 3</a></li> 
                </ul> '


}  
$template_hook['navtab_start'] .= '<li'.$tabselected.'><a class="navtab" href="/content.php?5-News">News</a>'.$tablinks.'</li>' 

I have this on my Navbar: Insert CMS Navbar Entry plugin
PHP Code:
if (defined('CMS_SCRIPT') AND class_exists('vBCms_Navbar'))
{
    
$vbulletin->options['selectednavtab'] = 'vbcms';
    
$template_hook['navtab_start'] .= vBCms_NavBar::renderView();
}

if (
intval($_GET['r'] == 'r=5-News')) {

}

else
{
    if (
can_see_cms())
    {
    
$template_hook['navtab_start'] .= vB_Template::create('vbcms_navbar_link')->render();
        
$template_hook['navbar_getnew_menu_pos1'] .= vB_Template::create('vbcms_navbar_whatsnew_link')->render();
    }

What code should I execute to have only the current tab to be highlighted?

PHP Code:
if (intval($_GET['r'] == 'r=5-News')) {
   ?

Reply With Quote
  #10  
Old 05-09-2012, 03:02 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is the line you needed to modify to exclude your own condition:

PHP Code:
if (defined('CMS_SCRIPT') AND class_exists('vBCms_Navbar')) 
to something like:

PHP Code:
if (defined('CMS_SCRIPT') AND class_exists('vBCms_Navbar') AND (intval($_GET['r']) != 5)) 
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 02:03 AM.


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.04552 seconds
  • Memory Usage 2,276KB
  • Queries Executed 11 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (7)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (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_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_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete