vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   [HOW TO - vB4] Create a New Tab in the navbar (https://vborg.vbsupport.ru/showthread.php?t=226914)

DaMani 03-12-2010 11:09 PM

Hello,

i created it, but i dont get submenu?
Look here:
http://project-mp.com/index.php

Titel in navbar is "Webradio"

Jabong82 03-12-2010 11:45 PM

Hi Lynne great tutorial I was able to get it to work fine on some tabs, but I am having problems when I have "conflicting" items.

For example, I am trying to create a separate tab for the "usercp.php" page called "My Forums", however I guess the usercp.php page is already tied to the main Forum tab. So when I click the new tab I created, I get both tabs highlighted and the submenus overlap.

I am not certain how to make the new tab "unique" if that makes sense. Any help would be appreciated thank you.

Lynne 03-13-2010 02:01 AM

Quote:

Originally Posted by DaMani (Post 2002493)
Hello,

i created it, but i dont get submenu?
Look here:
http://project-mp.com/index.php

Titel in navbar is "Webradio"

What is the condition you used to show the sub-forum? It needs to be valid, otherwise the Forum tab is the default tab.

Quote:

Originally Posted by Jabong82 (Post 2002508)
Hi Lynne great tutorial I was able to get it to work fine on some tabs, but I am having problems when I have "conflicting" items.

For example, I am trying to create a separate tab for the "usercp.php" page called "My Forums", however I guess the usercp.php page is already tied to the main Forum tab. So when I click the new tab I created, I get both tabs highlighted and the submenus overlap.

I am not certain how to make the new tab "unique" if that makes sense. Any help would be appreciated thank you.

You may have to edit the navbar template where the condition for showing the submenu for the usercp is. This is in the navbar template:
<vb:elseif condition="$vboptions['selectednavtab']=='usercp'" />

So, you'll need to change that to say "if selectednavtab is usercp but NOT whatever-your-condition-is"

DaMani 03-13-2010 10:58 AM

Quote:

Originally Posted by Lynne (Post 2002546)
What is the condition you used to show the sub-forum? It needs to be valid, otherwise the Forum tab is the default tab.


You may have to edit the navbar template where the condition for showing the submenu for the usercp is. This is in the navbar template:
<vb:elseif condition="$vboptions['selectednavtab']=='usercp'" />

So, you'll need to change that to say "if selectednavtab is usercp but NOT whatever-your-condition-is"

I dont understand, my english is not so good. What i must do?

Lynne 03-13-2010 10:06 PM

I don't know how else to explain it. In the navbar code, there is a submenu set to be displayed when you are in the usercp. You are trying to create a different one to show. The two conditions cannot exist at the same time. You need to have UNIQUE conditions or only one can display.

Switch3130 03-14-2010 06:03 AM

How do we make this new tab have a drop down menu?

Lynne 03-14-2010 03:25 PM

Quote:

Originally Posted by Switch3130 (Post 2003253)
How do we make this new tab have a drop down menu?

In the code in the first post, one of the submenu items is a dropdown. If you are talking about the navtab itself being a dropdown, someone else wrote an article for that (I think it was Shelby).

stlracing 03-15-2010 11:21 PM

OK... I'm stuck here. I get an error when i activate the code...

arse error: syntax error, unexpected T_STRING in /public_html/forums/includes/class_bootstrap.php(399) : eval()'d code on line 61

Code:

$tabselected = '';
$tablinks = '';
if (in_array($foruminfo['forumid'], array(24,36,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,96,101,103,105,127,129,130,131)))
{
    $vbulletin->options['selectednavtab']='racing_news';
    $tabselected = ' class="selected"';
    $tablinks = '                <ul class="floatcontainer">
                            <li class="popupmenu">
                                <a href="javascript://" class="popupctrl">Late Model News</a>
                                <ul class="popupbody popuphover">
                                        <li><a href="http://www.mysite.com/forums/forumdisplay.php?88-General-Other-Dirt-Late-Model-News">General/Other Late Model News</a></li>
                                        <li><a href="http://www.mysite.com/forums/forumdisplay.php?55-Crate-Late-Model-Series">Crate Late Model News</a></li>
                                        <li><a href="http://www.mysite.com/forums/forumdisplay.php?47-Lucas-Oil-Late-Model-Series">Lucas Oil Late Model Series News</a></li>
                                        <li><a href="http://www.mysite.com/forums/forumdisplay.php?48-Mid-America-Racing-Series-(MARS)">MARS DIRTcar Series News</a></li>
                                        <li><a href="http://www.mysite.com/forums/forumdisplay.php?52-MLRA-TORA-SUPR-AMP-MSRA-amp-Other-Series">MLRA/MSRA/SUPR & Other Series News</a></li>
                                        <li><a href="http://www.mysite.com/forums/forumdisplay.php?49-United-Midwestern-Promoters-(UMP)">U.M.P. DIRTcar News</a></li>
                                        <li><a href="http://www.mysite.com/forums/forumdisplay.php?46-World-of-Outlaw-Late-Model-Series">World of Outlaw Late Model Series News</a></li>
                                </ul>
                            </li>
                            <li class="popupmenu">
                                <a href="javascript://" class="popupctrl">Sprint Car News</a>
                                <ul class="popupbody popuphover">
                                        <li><a href="http://www.mysite.com/forums/forumdisplay.php?89-General-Other-Sprint-Midget-News">General/Other Sprint-Midget News</a></li>
                                        <li><a href="http://www.mysite.com/forums/forumdisplay.php?134-American-Sprint-Car-Series-(ASCS)">American Sprint Car Series (ASCS) News</a></li>
                                        <li><a href="http://www.mysite.com/forums/forumdisplay.php?77-All-Star-Sprint-Series">All Star Sprint Series News</a></li>
                                        <li><a href="http://www.mysite.com/forums/forumdisplay.php?78-O-Reilly-POWRi-Series">O'Reilly POWRi Series News</a></li>
                                        <li><a href="http://www.mysite.com/forums/forumdisplay.php?92-USAC">USAC News</a></li>
                                        <li><a href="http://www.mysite.com/forums/forumdisplay.php?75-World-of-Outlaws-Sprint-Car-Series">World of Outlaws Sprint Car Series News</a></li>
                                </ul>
                            </li>
                            <li class="popupmenu">
                                <a href="javascript://" class="popupctrl">Race Track News</a>
                                <ul class="popupbody popuphover">
                                        <li><a href="http://www.mysite.com/forums/forumdisplay.php?53-Belle-Clair-Speedway">Belle-Clair Speedway</a></li>
                                        <li><a href="sublink2.php">SubLink 2</a></li>
                                        <li><a href="sublink3.php">SubLink 3</a></li>
                                </ul>
                            </li>
                        <li><a href="http://www.mysite.com/forums/forumdisplay.php?36-Race-Team-News">Race Teams News</a></li>
                </ul> ';

}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="http://www.mysite.com/forums/forumdisplay.php?24-Racing-News">Racing News</a>'.$tablinks.'</li>' ;

--------------- Added [DATE]1268705656[/DATE] at [TIME]1268705656[/TIME] ---------------

Found my issue.. One of my links had a ' in the link description.

Link14716 03-16-2010 06:36 AM

Excellent guide, thanks Lynne. Finally making my first venture into making new pages in vB4 and this helped me a lot. :)

pant 03-17-2010 11:29 AM

Does anyone know of a guide on how to recreate the quick links including drop downs in the Navbar?

cellarius 03-17-2010 11:34 AM

All you need to create a dropdown is there in the code from first post in this thread:
HTML Code:

                            <li class="popupmenu">
                                <a href="javascript://" class="popupctrl">Drop Down</a>
                                <ul class="popupbody popuphover">
                                        <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>
                                </ul>
                            </li>


pant 03-17-2010 11:36 AM

Right see all people really want is a button on the navbar saying what's going on. What would I have to do for that?

Lynne 03-17-2010 02:25 PM

Quote:

Originally Posted by pant (Post 2005450)
Right see all people really want is a button on the navbar saying what's going on. What would I have to do for that?

There are several different articles/mods for the navtabs and submenu. If all you want is another button on the submenu, then you should go to Allan's tutorial. If all you want is a navtab, then there are modifications to do that.

steven s 03-29-2010 12:18 AM

I've used portions of this article which worked great through 4.0.2pl2.
Now with pl4 I don't see the selections of the link until I hover over it.

Problem with Firefox Mac and PC.
Anyone else having this problem?

SOLVED: Reverted template.

Yonatan 03-30-2010 09:05 PM

And what if I want to link into section like:
Code:

content.php?r=5
instead of clean php page?

jacx 03-31-2010 01:24 AM

Ok chaps...please please please do not bite my head off.

I understand the basics of this and Lynne thank you for producing this guide.

What im not understanding is how to link offsite.

For example our site has a number of facebook games...we produce them (dont hate me).

I want to be able to link to those sites.

Now currently I use: vBH - Add new tabs 1.2 1.2 This plugin adds new tabs to the main navbar

this is of course fine and dandy...however till you get to the issue of screen size. People with smaller screens end up with squished nav buttons.

example http://forum.clipwiregames.com/forum.php if u use half screen u will notice all the additional tabs get squished.

Now i did a couple of test tabs using Lynnes setup and they did not, it worked perfect.

Thus my only issue is understanding how to make the links not internal php links but external.

thanks ...hopefully i made myself semi clear.

Lynne 03-31-2010 03:52 AM

Quote:

Originally Posted by Yonatan (Post 2013101)
And what if I want to link into section like:
Code:

content.php?r=5
instead of clean php page?

Why couldn't you link to that?

Quote:

Originally Posted by jacx (Post 2013194)
Ok chaps...please please please do not bite my head off.

I understand the basics of this and Lynne thank you for producing this guide.

What im not understanding is how to link offsite.

For example our site has a number of facebook games...we produce them (dont hate me).

I want to be able to link to those sites.

Now currently I use: vBH - Add new tabs 1.2 1.2 This plugin adds new tabs to the main navbar

this is of course fine and dandy...however till you get to the issue of screen size. People with smaller screens end up with squished nav buttons.

example http://forum.clipwiregames.com/forum.php if u use half screen u will notice all the additional tabs get squished.

Now i did a couple of test tabs using Lynnes setup and they did not, it worked perfect.

Thus my only issue is understanding how to make the links not internal php links but external.

thanks ...hopefully i made myself semi clear.

Instead of:
PHP Code:

<a href="/page.php">A page on your site</a

do:
PHP Code:

<a href="http://www.anothersite.com/page">A page on another site</a


Yonatan 03-31-2010 10:03 AM

Quote:

Originally Posted by Lynne (Post 2013240)
Why couldn't you link to that?

I did it. but the problem is that when I press in this button the navbar still selects the Forum tab, because I can't do a condition in this section:
PHP Code:

if (THIS_SCRIPT == 'yourpage')
{

    
$vbulletin->options['selectednavtab']='unique_name';
    
$tabselected ' class="selected"';




cellarius 03-31-2010 10:11 AM

If you're linking to a site outsiede vB, it does not make much sense to show a tab as highlighted. You simply don't need that part.

Yonatan 03-31-2010 10:55 AM

Quote:

Originally Posted by cellarius (Post 2013369)
If you're linking to a site outsiede vB, it does not make much sense to show a tab as highlighted. You simply don't need that part.

I linking to section in vBulletin!

cellarius 03-31-2010 11:06 AM

Sorry, I mixed you up with jacx. Anyway, I posted the solution for your problem on the previous page of this thread, #199

Yonatan 03-31-2010 11:34 AM

Quote:

Originally Posted by cellarius (Post 2013382)
Sorry, I mixed you up with jacx. Anyway, I posted the solution for your problem on the previous page of this thread, #199

I got this error:
Quote:

Fatal error: Call to a member function getNodeId() on a non-object in /home/*username*/public_html/vb/includes/class_bootstrap.php(399) : eval()'d code on line 3
when I used this code.

this is my code:
PHP Code:

$tabselected '';
$tablinks '';
if (
in_array($this->content->getNodeId(), 5))  
{
    
$vbulletin->options['selectednavtab']='content.php?r=5';
    
$tabselected ' class="selected"';
    
$tablinks '';

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


jacx 03-31-2010 02:09 PM

Quote:

Originally Posted by Lynne (Post 2013240)
Why couldn't you link to that?


Instead of:
PHP Code:

<a href="/page.php">A page on your site</a

do:
PHP Code:

<a href="http://www.anothersite.com/page">A page on another site</a



when i tried that it took me to http://mysite.com/link.php

Edit...im trying to post the code i used and keep getting "Bad Request" when i do it..anyone know what im doing wrong so i can post what i had entered?

vglobal 03-31-2010 06:00 PM

Hi Lynne,

If I want only the user with id=1 to see the link. What I have to do?

Thanks.

Lynne 03-31-2010 06:59 PM

Quote:

Originally Posted by jacx (Post 2013478)
when i tried that it took me to http://mysite.com/link.php

Then you have a setting or modification that is doing that. If you have the link written as going to http://www.somesite.com/link.php then it should go there, not to your site.
Quote:

Originally Posted by vglobal (Post 2013600)
Hi Lynne,

If I want only the user with id=1 to see the link. What I have to do?

Thanks.

This was covered, I think, on page 2 or 3.

Jason92s 03-31-2010 07:08 PM

I created a PHP file with nothing in it but the following:

PHP Code:

<?php
define
('THIS_SCRIPT''locallinks');
?>

My plugin script has the following:

PHP Code:

if (THIS_SCRIPT == 'locallinks')
{
    
$vbulletin->options['selectednavtab']='locallinks'

At the bottom of the plugin is:

PHP Code:

$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="/index.php?pageid=locallinks">Test Link</a>'.$tablinks.'</li>' 


When I click on my new tab, it highlights the Forum tab and shows all the regular stuff found under Forum (New Posts, Private Messages, FAQ, etc).

Any help is appreciated.

vglobal 03-31-2010 07:54 PM

Quote:

Originally Posted by Lynne (Post 2013625)
This was covered, I think, on page 2 or 3.

Thanks, but that is cover for usergroup.

I create new NavTab as follow, and I want only me to see the Chat Admin. Please help.
Code:

$tabselected = '';
                $tablinks = '';
                if (THIS_SCRIPT == 'chat')
                    {
                    $vbulletin->options['selectednavtab']='chat';
                    $tabselected = ' class="selected"';
                    $tablinks = ' <ul class="floatcontainer">
                        <li><a href="chat/admin.php" target="_blank">Chat Admin</a></li></ul> ';
                    } 
                $template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="chat.php">Chat</a>'.$tablinks.'</li>' ;


Lynne 03-31-2010 11:42 PM

Quote:

Originally Posted by Jason92s (Post 2013629)
I created a PHP file with nothing in it but the following:

PHP Code:

<?php
define
('THIS_SCRIPT''locallinks');
?>


According to your code, your page is located at http://yoursite.com/index.php?pageid=locallinks Yet, I'm guessing that is not the link to your actual php page you created above? You you get sent to index.php which is probably forwarded to your forum.php page (check the script) and thus the Forum tab gets highlighted.
Quote:

Originally Posted by vglobal (Post 2013664)
Thanks, but that is cover for usergroup.

I create new NavTab as follow, and I want only me to see the Chat Admin. Please help.
Code:

$tabselected = '';
                $tablinks = '';
                if (THIS_SCRIPT == 'chat')
                    {
                    $vbulletin->options['selectednavtab']='chat';
                    $tabselected = ' class="selected"';
                    $tablinks = ' <ul class="floatcontainer">
                        <li><a href="chat/admin.php" target="_blank">Chat Admin</a></li></ul> ';
                    } 
                $template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="chat.php">Chat</a>'.$tablinks.'</li>' ;


Instead of this sort of condition:
PHP Code:

if (is_member_of($vbulletin->userinfo567)) 

You would use this sort of condition:
PHP Code:

if ($vbulletin->userinfo['userid'] == 1

You probably want to wrap that condition around the full contents of the plugin if it is only to show for that userid.

vglobal 03-31-2010 11:47 PM

Thank you very much.

Jason92s 04-01-2010 03:49 PM

Thanks for the reply Lynne...I actually have no clue what I'm doing (is it that obvious?). I just want to have a new link called Local Links that when clicked will show 4 new sublinks with their own links. On the new tab I really don't need it to display any content when it's clicked, just the links. Is this the right mod for me? Thanks again.

Lynne 04-02-2010 01:53 PM

Quote:

Originally Posted by Jason92s (Post 2014122)
Thanks for the reply Lynne...I actually have no clue what I'm doing (is it that obvious?). I just want to have a new link called Local Links that when clicked will show 4 new sublinks with their own links. On the new tab I really don't need it to display any content when it's clicked, just the links. Is this the right mod for me? Thanks again.

It would be the correct mod, however you need to define exactly *when* those sub-menus are supposed to show. If you can't define that, then your sub-menus will never show.

Lynk 04-03-2010 02:31 AM

Lynne, this is brilliant! I upgraded my forums (drzforums.com) last night, and ran into a few pain-points. Using your instructions, I created the navigation tabs that I would like, reusing all of the sub-menu links from the "Forum" tab. Now, I'm left with one more question, which I am having difficulty finding through search.

There is one "Quick Link" that refers to a javascript code bite. How do I program "Open Contacts Popup?" Can you point me in the right direction?

Thank you for the trouble you went through to document the tab creation process!

Heh... I guess I'm going to have to setup some conditionals for several of the sub-menu items. :) (I just viewed my site as a guest.)

Lynne 04-03-2010 03:01 AM

Quote:

Originally Posted by Lynk (Post 2014943)
There is one "Quick Link" that refers to a javascript code bite. How do I program "Open Contacts Popup?" Can you point me in the right direction?

I'm not sure what you mean by How do you program it.

NashChristian 04-04-2010 07:07 PM

THANKS Lynne! Very helpful!

Jason92s 04-05-2010 12:45 AM

Quote:

Originally Posted by Lynne (Post 2014652)
It would be the correct mod, however you need to define exactly *when* those sub-menus are supposed to show. If you can't define that, then your sub-menus will never show.

Gotcha...I only want them to show when I click the tab that they belong to. In a perfect world, when the user clicks a tab called Local Links, they will see 3 submenus appear below: 1) EG, 2) Laguna, 3) Sac. Then each of those will have their own URL or additional sub-menus to offsite pages or whatever. The "Local Links" page that opens when the user clicks the tab doesn't need any data if that's possible. Or if it must contain text, then I can just enter something describing the page to the user. Does that make any sense and is it possible? Thank you.

Lynne 04-05-2010 02:59 AM

Quote:

Originally Posted by Jason92s (Post 2015896)
Gotcha...I only want them to show when I click the tab that they belong to. In a perfect world, when the user clicks a tab called Local Links, they will see 3 submenus appear below: 1) EG, 2) Laguna, 3) Sac. Then each of those will have their own URL or additional sub-menus to offsite pages or whatever. The "Local Links" page that opens when the user clicks the tab doesn't need any data if that's possible. Or if it must contain text, then I can just enter something describing the page to the user. Does that make any sense and is it possible? Thank you.

Ok, so write that as a condition now. For other vbulletin pages, THIS_SCRIPT is defined at the top - so if you only want something to happen on the showthread page, the condition is THIS_SCRIPT == 'showthread'... so, what defines your page? Have you defined THIS_SCRIPT in it? If so, just use that as the condition in the plugin.

Jason92s 04-05-2010 03:22 AM

Do you know if it's possible to use vbAdvanced to create a BB Code page and have it work with this mod then? If memory serves the url looks something like sitename.com/index.php?pageid=pagename

what would you use for THIS_SCRIPT in that situation?

SOLVED:

I used:

if (THIS_SCRIPT == 'adv_index' AND $pages['name'] == 'testpage')

alfanexus 04-07-2010 12:51 PM

I want to create a tab for a specific section in the CMS. Is there a way to get the section name in the PHP code?

I can see the section name in the navbar so maby I can get the navbar text and use this for a compare?

I was thinking something like

PHP Code:

if (THIS_SCRIPT == 'vbcms')
{
          if (
sectionname =='My Section')
          {
           
$vbulletin->options['selectednavtab']='unique_name';
           
$tabselected ' class="selected"';
           
$tablinks '                <ul class="floatcontainer">
                        <li><a href="link1.php">Link 1</a></li>
                            <li class="popupmenu">
                                <a href="javascript://" class="popupctrl">Drop Down</a>
                                <ul class="popupbody popuphover">
                                        <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>
                                </ul>
                            </li>
                        <li><a href="link2.php">Link 2</a></li>
                        <li><a href="link3.php">Link 3</a></li>
                </ul> '
;


          }



Please can anyone help? I have searched for this the whole day

Lynne 04-07-2010 01:58 PM

Quote:

Originally Posted by alfanexus (Post 2017407)
I want to create a tab for a specific section in the CMS. Is there a way to get the section name in the PHP code?

I can see the section name in the navbar so maby I can get the navbar text and use this for a compare?

I was thinking something like

Please can anyone help? I have searched for this the whole day

You didn't put anything in your code that showed what variable names you have tried for the section name.

alfanexus 04-07-2010 02:19 PM

Quote:

Originally Posted by Lynne (Post 2017445)
You didn't put anything in your code that showed what variable names you have tried for the section name.

No that was my question :) what variable names can I use to get a section?

Sorry if I am not being clear, I was hoping someone new a way to check for a section name in the php code.


All times are GMT. The time now is 06:50 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.02175 seconds
  • Memory Usage 1,938KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (1)bbcode_html_printable
  • (13)bbcode_php_printable
  • (23)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete