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)

Lynne 07-17-2011 04:00 PM

Do a search in this thread for "is_member_of" because that is what you would use in the condition and I know this has been covered before in this thread.

mhudson 07-17-2011 05:19 PM

ah thanks Lynne. I kinda skimmed though the thread 30 pages is a lot to take in.

all sorted now :) works perfectly

Spyike 07-18-2011 07:15 PM

Can somebody tell me what is wrong with my code? I keep getting a syntax error and cannot seem to see where I made an error..

Code:

if (is_member_of($vbulletin->userinfo, 1))
{
$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'spyikereg')
{
    $vbulletin->options['selectednavtab']='spyreg';
    $tabselected = ' class="selected"';
}
$template_hook['navtab_middle'] .= '<li'.$tabselected.'><a class="navtab" href="http://spyike.org/register.php">Register</a>'.$tablinks.'</li>' ;


Lynne 07-18-2011 08:32 PM

Quote:

Originally Posted by Spyike (Post 2222089)
Can somebody tell me what is wrong with my code? I keep getting a syntax error and cannot seem to see where I made an error..

Code:

if (is_member_of($vbulletin->userinfo, 1))
{
$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'spyikereg')
{
    $vbulletin->options['selectednavtab']='spyreg';
    $tabselected = ' class="selected"';
}
$template_hook['navtab_middle'] .= '<li'.$tabselected.'><a class="navtab" href="http://spyike.org/register.php">Register</a>'.$tablinks.'</li>' ;


You forgot the ending } to your is_member_of condition. :)

cellarius 07-18-2011 08:33 PM

1. Why don't you give the exact error message instead if making us search & guess?
2. Use indenting to make your code more readable.
3. You're missing a closing curly bracket at the end, that's for sure.

// Edit: Lynne beat me to it :D

Spyike 07-18-2011 10:00 PM

Quote:

Originally Posted by Lynne (Post 2222111)
You forgot the ending } to your is_member_of condition. :)

Where does it belong..?

Thank you for the quick response.

HMBeaty 07-18-2011 10:05 PM

Quote:

Originally Posted by Spyike (Post 2222157)
Where does it belong..?

Thank you for the quick response.

Your code should look like:
PHP Code:

if (is_member_of($vbulletin->userinfo1))
{
    
$tabselected '';
    
$tablinks '';

    if (
THIS_SCRIPT == 'spyikereg')
    {
        
$vbulletin->options['selectednavtab']='spyreg';
        
$tabselected ' class="selected"';
    } 

    
$template_hook['navtab_middle'] .= '<li'.$tabselected.'><a class="navtab" href="http://spyike.org/register.php">Register</a>'.$tablinks.'</li>' ;



Spyike 07-18-2011 10:07 PM

Quote:

Originally Posted by HMBeaty (Post 2222159)
Your code should look like:

Greatly appreciate it, thanks.

HMBeaty 07-18-2011 10:07 PM

Quote:

Originally Posted by Spyike (Post 2222163)
Greatly appreciate it, thanks.

No problem :)

Lynne 07-18-2011 10:09 PM

Quote:

Originally Posted by Spyike (Post 2222157)
Where does it belong..?

Thank you for the quick response.

It belongs at the very, very end. It should be your last line in the plugin.

edit: Well, I guess while I was typing Brooks was being the young whippersnapper he is and answering way, waaaaay faster than me!

HMBeaty 07-18-2011 10:18 PM

Quote:

Originally Posted by Lynne (Post 2222168)
It belongs at the very, very end. It should be your last line in the plugin.

edit: Well, I guess while I was typing Brooks was being the young whippersnapper he is and answering way, waaaaay faster than me!

Not really young anymore lol

Spyike 07-18-2011 10:18 PM

Quote:

Originally Posted by Lynne (Post 2222168)
It belongs at the very, very end. It should be your last line in the plugin.

edit: Well, I guess while I was typing Brooks was being the young whippersnapper he is and answering way, waaaaay faster than me!

Thank you as well.

If I wanted to have the Sublink drop downs directly from the original tab, rather than Tab > Link > Sublink, would I simply delete the lists and leave the unordered lists?

Thanks

Lynne 07-18-2011 11:25 PM

Quote:

Originally Posted by Spyike (Post 2222175)
Thank you as well.

If I wanted to have the Sublink drop downs directly from the original tab, rather than Tab > Link > Sublink, would I simply delete the lists and leave the unordered lists?

Thanks

There is another article about how to make the navtabs dropdowns themselves. You should be able to find it in this forum.

Spyike 07-18-2011 11:49 PM

Quote:

Originally Posted by Lynne (Post 2222201)
There is another article about how to make the navtabs dropdowns themselves. You should be able to find it in this forum.

https://vborg.vbsupport.ru/showthread.php?t=232579 only applies to the Sublink drop downs as does https://vborg.vbsupport.ru/showthread.php?t=232579

AlokSharma 07-30-2011 06:26 AM

Just in case, if someone only wants to add a tab, here is the modified code:

PHP Code:

$tabselected '';
$tablinks '';
if (
THIS_SCRIPT == 'chat')
{
    
$vbulletin->options['selectednavtab']='chat';
    
$tabselected ' class="selected"';

$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="chat.php">Chat</a>'.$tablinks.'</li>' 

Replace:
PHP Code:

if (THIS_SCRIPT == 'chat'

and
PHP Code:

$vbulletin->options['selectednavtab']='chat'

With some unique name.

odln018 08-12-2011 05:00 PM

If possible, could I get some personal assistance in getting this to work on my forum?

I would try some products, but I'm concerned about the developers bailing out, and figure it would be beneficial just to see how it's done "manually".

christian gate 08-15-2011 06:47 PM

Hi, I have 2 questions please

1. If I need to create more than 1 tab, would I have to keep adding this blugin for each tab, if not so how can i use it for more than 1 tab?

2. I need to make 3 different forums ( already Exit), each will have own tab in the navbar, can I do that with this blugin, how?

I am new with coding and if you please give me a step by step instructions.


Thanks:confused:

Lynne 08-15-2011 11:33 PM

1. You may add the plugin code several times into the same plugin and just change the condition for each.

2. Just add a unique condition for each.

HolyKiller 08-17-2011 09:16 PM

Lynne & wowautoauctions: THANKS a LOT !!!

It works excelent for sub-forum with proper highlighting!


Code:

$tabselected = '';
$tablinks = '';
if ($GLOBALS['forumid'] == 222)
{
    $vbulletin->options['selectednavtab']='SOMETHING';
    $tabselected = ' class="selected"';
}
$template_hook['navtab_middle'] .= '<li'.$tabselected.'><a class="navtab" href="http://yoursite/forumdisplay.php/222-Blablabla">SOMETHING</a>'.$tablinks.'</li>' ;

Anyway, one more thing...

Now i have navbar like this:

CMS_FORUM_BLOGS_AAA_BBB_CCC_WHATSNEW

and i would like to have it like this:

CMS_FORUM_AAA_BBB_CCC_BLOGS_WHATSNEW

How to "move" that "BLOG" to the right?

Thanks!

Lynne 08-17-2011 10:49 PM

Quote:

Originally Posted by HolyKiller (Post 2234727)
Anyway, one more thing...

Now i have navbar like this:

CMS_FORUM_BLOGS_AAA_BBB_CCC_WHATSNEW

and i would like to have it like this:

CMS_FORUM_AAA_BBB_CCC_WHATSNEW_BLOGS

How to "move" that "BLOG" to the right?

Thanks!

There are template_hooks in the navbar that are being used to place the navtabs. If you want to move a tab, then find the template hook you want to use and change the existing one (in this case it is a plugin in the blog product) to use the new one.

HolyKiller 08-17-2011 11:12 PM

Ha, i found it under "Navbar: Eval Blog Link Template and Validate Styleid" so i changed:

$template_hook['navtab_middle'] .= vB_Template::create('blog_navbar_link')->render();
to
$template_hook['navtab_end'] .= vB_Template::create('blog_navbar_link')->render();

But now it is like

CMS_FORUM_AAA_BBB_CCC_WHATSNEW_BLOGS

so i would like to change BLOG<->WHATSNEW ... like this

CMS_FORUM_AAA_BBB_CCC_BLOGS_WHATSNEW
(My previouws post was wrong, i already fixed it)

And i cant see any hook for WhatsNew ... i guess, i need to digg it somewhere else :D

EDIT: WoW Lynne you so fast, i did not saw your reply, thanks!

EDIT2: Solved! My script had "Execution Order" set to "15" and that Blog one was "6", so i set "5" for my script and set Blog back to "middle", which isi "Execution Order: 6" ... and VOALA :)

Ethelbert 08-25-2011 09:11 AM

It is possible to change order? Standard order is at the end.. but I want to have it before Home link, blog link and forum link.. It is possible?

Lynne 08-25-2011 03:11 PM

Quote:

Originally Posted by Ethelbert (Post 2237828)
It is possible to change order? Standard order is at the end.. but I want to have it before Home link, blog link and forum link.. It is possible?

As I stated in the first post, there are other template_hooks you can use - navtab_start, navtab_middle, and navtab_end. And then you could change the execution order also if two navtabs use the same template_hook and you want them in a different order.

Breakthecycle2 10-30-2011 11:37 PM

Quick question Lynn,

my site: www.droid-tech.com.

I want to add a tab,"Friends of Droid Tech", with a submenu of our friends links. What would I need to add in the if (THIS_SCRIPT == 'yourpage').

Would it be "Droid Tech Friends"? or my forums page?

Lynne 10-31-2011 02:46 AM

Quote:

Originally Posted by Breakthecycle2 (Post 2263024)
Quick question Lynn,

my site: www.droid-tech.com.

I want to add a tab,"Friends of Droid Tech", with a submenu of our friends links. What would I need to add in the if (THIS_SCRIPT == 'yourpage').

Would it be "Droid Tech Friends"? or my forums page?

I don't know as you didn't say where this tab is supposed to link to. If it links to the forum.php page, then you would use THIS_SCRIPT == 'index'

ForceHSS 10-31-2011 04:02 AM

Quote:

Originally Posted by Breakthecycle2 (Post 2263024)
Quick question Lynn,

my site: www.droid-tech.com.

I want to add a tab,"Friends of Droid Tech", with a submenu of our friends links. What would I need to add in the if (THIS_SCRIPT == 'yourpage').

Would it be "Droid Tech Friends"? or my forums page?

why dont you just use the plugin I installed for you

Breakthecycle2 10-31-2011 04:22 AM

Quote:

Originally Posted by ForceHSS (Post 2263076)
why dont you just use the plugin I installed for you

Can you add a submenu with that? I thought you said I couldn't?

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

Quote:

Originally Posted by Lynne (Post 2263063)
I don't know as you didn't say where this tab is supposed to link to. If it links to the forum.php page, then you would use THIS_SCRIPT == 'index'

All I am looking to do is add a tab in the navbar, labeled "friends" with sub links to friends sites.

Breakthecycle2 11-01-2011 09:09 PM

Can anyone give me a quick hand here?

Lynne 11-02-2011 04:25 PM

The "Friends" tab needs to link to a page. When someone clicks on it, what page does it take them to? I can't help until you answer that question.

Breakthecycle2 11-03-2011 12:59 AM

Quote:

Originally Posted by Lynne (Post 2263815)
The "Friends" tab needs to link to a page. When someone clicks on it, what page does it take them to? I can't help until you answer that question.

So, the actual tab needs to link somewhere first? Even if I just want the tab with a submenu with links?

Lynne 11-03-2011 04:45 AM

Quote:

Originally Posted by Breakthecycle2 (Post 2263950)
So, the actual tab needs to link somewhere first? Even if I just want the tab with a submenu with links?

Yes. There is another article on making the navtab an actual dropdown. Perhaps that would be better for you. (it's an article in this same forum, I'm sure you can find it.)

smimosmile 11-05-2011 06:58 PM

Thank you Lynne, it really helped me, i created an "ibproarcade" tab using (THIS_SCRIPT == 'arcade') as it's mensioned in arcade.php file, and i created 2 other tabs with no "if" for non VB pages

Empire Gaming 11-06-2011 12:30 PM

Quote:

Originally Posted by AlokSharma (Post 2226713)
Just in case, if someone only wants to add a tab, here is the modified code:

PHP Code:

$tabselected '';
$tablinks '';
if (
THIS_SCRIPT == 'chat')
{
    
$vbulletin->options['selectednavtab']='chat';
    
$tabselected ' class="selected"';

$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="chat.php">Chat</a>'.$tablinks.'</li>' 

Replace:
PHP Code:

if (THIS_SCRIPT == 'chat'

and
PHP Code:

$vbulletin->options['selectednavtab']='chat'

With some unique name.

Here is what I have:

PHP Code:

$tabselected '';
$tablinks '';
if (
THIS_SCRIPT == 'home')
{
    
$vbulletin->options['selectednavtab']='home';
    
$tabselected ' class="selected"';

$template_hook['navtab_start'] .= '<li'.$tabselected.'><a class="navtab" href="http://www.egcglobal.com">Home</a>'.$tablinks.'</li>' 

The tab itself shows up on all my pages, even my vBa main page, but I still cannot for the life of me figure out how to have the "Home" button be highlighted when it is selected.

https://vborg.vbsupport.ru/external/2011/11/60.jpg

If I click on it, it takes me to my main vBa portal page (www.egcglobal.com) but it is the "Forum" button that stays highlighted.

Anyone have any ideas on how to fix this?


[SOLUTION BELOW]

Ok, so for anyone else who may be having the same issue as I was, if you are running vBa and want a "home" button, your plugin should look like below. Just remember to change the URL to your main page.

PHP Code:

$tabselected '';
$tablinks '';
if (
THIS_SCRIPT == 'adv_index')
{
    
$vbulletin->options['selectednavtab']='Home';
    
$tabselected ' class="selected"';


$template_hook['navtab_start'] .= '<li'.$tabselected.'><a class="navtab" href="http://www.egcglobal.com">Home</a>'.$tablinks.'</li>' 

https://vborg.vbsupport.ru/external/2011/11/61.jpg

Thanks again to both Hippy & PankajKumar for helping me out and to Lynn for starting me on this quest : )

Hippy 11-06-2011 12:48 PM

loook in the file and search for THIS_SCRIPT
and see what it says then add it to the admincp option where you added the new tab

if it's vbadvanced it should look like this
THIS_SCRIPT == 'adv_index'

define('THIS_SCRIPT', 'adv_index');

Empire Gaming 11-06-2011 01:06 PM

Quote:

Originally Posted by PankajKumar (Post 2113627)
Thanks Lynne,

I did that and it worked smooth. And I figured it out why it was happening. Just in case someone else is facing this problem, its defined in the vbadvanced php file, similar things can happen if used with other php files. Just a Tip.

Thanks again.

You Rock. Thanks. This fixed my problem with the "Forum" button staying highlighted.:D

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

Quote:

Originally Posted by Hippy (Post 2264959)
loook in the file and search for THIS_SCRIPT
and see what it says then add it to the admincp option where you added the new tab


if it's vbadvanced it should look like this
THIS_SCRIPT == 'adv_index'

define('THIS_SCRIPT', 'adv_index');

Thanks. I just did that before I saw your suggestion :o

rootsxrocks 11-06-2011 06:41 PM

How would I go about doing this for the Calender and the Groups in vb4.1.7 and will there be any problems going to 4.1.8 . I am not sure what sub menues I would need I just want it to be out front and not hidden.

Lynne 11-06-2011 09:01 PM

Quote:

Originally Posted by rootsxrocks (Post 2265086)
How would I go about doing this for the Calender and the Groups in vb4.1.7 and will there be any problems going to 4.1.8 . I am not sure what sub menues I would need I just want it to be out front and not hidden.

Just something like:
PHP Code:

$tabselected '';
$tablinks '';
if (
THIS_SCRIPT == 'calendar')
{
    
$vbulletin->options['selectednavtab']='calendar';
    
$tabselected ' class="selected"';


$template_hook['navtab_start'] .= '<li'.$tabselected.'><a class="navtab" href="calendar.php">Calendar</a></li>' 

and do similar for any other tab you want.

rootsxrocks 11-07-2011 04:24 PM

Thank you Lynne I will give it a try

rokslide 11-19-2011 11:52 AM

Please help. This worked very well and I got the new tab set up but for some reason it will only let me have six links. When I add the seventh link the page goes haywire! Any ideas?

Thanks

Lynne 11-19-2011 03:01 PM

Sure, don't have more than six tabs! There is just not that much room to have a ton of tabs there. Consider a dropdown tab instead (different article).


All times are GMT. The time now is 06:14 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.02115 seconds
  • Memory Usage 1,884KB
  • 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
  • (3)bbcode_code_printable
  • (10)bbcode_php_printable
  • (22)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (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