PDA

View Full Version : [HOW TO - vB4] Create a New Tab in the navbar


Pages : 1 [2] 3

Mythotical
04-22-2010, 02:15 AM
Using $_GET['r'] isn't working. It will still have the Home tab and the new tab highlighted with both overlapping each other for sub links.

arilukes
04-26-2010, 12:49 AM
This works perfectly and is a very easy to understand tutorial on how to create a new tab. I had no problems whatsoever in implementing this.

Thank you so much

Mythotical
04-26-2010, 04:36 PM
Ok Yonatan's suggestion didn't work on 4.0.3 PL1. It is causing Home and my tab to be highlighted with all subsections from both displaying.

Lynne
04-26-2010, 06:29 PM
Ok Yonatan's suggestion didn't work on 4.0.3 PL1. It is causing Home and my tab to be highlighted with all subsections from both displaying.
How did you modify the condition for the submenu for the Home tab? If you don't modify it, it will always show as long as you are in the vbcms area since that is how the condition is written.

arilukes
04-28-2010, 06:07 AM
I guess the code doesn't work for anything child level including subsections. I used $_GET and put all of my sections and subsections in an array in the vbcms, but only the top level sections will show the tab as hightlighted with the proper subnavbar below. If I click on a subsection, the correct tab stays highlighted, but the subnavbar selections disappear.

This is what I am using in the vbcms

<vb:if condition="$vboptions['selectednavtab'] == 'vbcms' AND !in_array($_GET['r'], array(181,182,183,184,185,186,187,188,189,190,199, 200,201,202,203,210,211,212,213,214,215,216,217,21 8,219,220,221,222))">

I tried using this in my tab plug-in to see if this fixed the issue

if (((in_array($_GET['r'], array(181,182,183,184,185,186,187,189,190)) && (THIS_SCRIPT == 'vbcms')))

but I get this error

Parse error: syntax error, unexpected '{' in /data/22/2/56/92/2056418/user/2253608/htdocs/forumsbb/includes/class_bootstrap.php(399) : eval()'d code on line 14

Lynne
04-28-2010, 01:40 PM
Count your ( and ) - they don't add up, which is why you got the error.

arilukes
04-28-2010, 10:18 PM
Yup that was totally it. Thanks!

aaronater
04-29-2010, 01:12 PM
Hi, this thread is very long and I'm still quite new to vB but have experience in developing. Is there a tutorial somewhere that shows you how to create the new sections and how to have the navbar tabs link to them all in one?

Thanks.

Lynne
04-29-2010, 01:45 PM
Hi, this thread is very long and I'm still quite new to vB but have experience in developing. Is there a tutorial somewhere that shows you how to create the new sections and how to have the navbar tabs link to them all in one?

Thanks.
Create Sections? Like in the CMS? There are a bunch of articles on vb.com about the CMS. And when you create a section, you may select the option to put the link in the subnavmenu. You can read the articles about this.

aaronater
04-29-2010, 02:20 PM
Hi,

Thanks, the thing is when I search 'create new section' or 'create section' I do not get any returns of any interset. I have tried searching but find lots of really basic stuff but not how to create new sections, I might be confused.

Basically I want to create a new tab called 'Contacts' which will link to a page with lists of names and contact details. It's straight forward how to add the tab but what about the pages of content to go along with it?

I understand the code you pasted originally and conditions.

In section manager I can only add sections to 'Home' I want to create a section to be linked to the new tab 'Contacts'

Lynne
04-30-2010, 02:23 AM
I can't tell whether you are talking about the CMS or not. If so, the place you should look for documentation is on vb.com > click the Home tab there and read all the articles about it.

If you are simply talking about adding another page and then linking to that page with a navtab, then this is the article to create the navtab, and if you look at my profile, you will find the article to create your own custom pages.

darsalles
05-01-2010, 09:26 PM
Hi there Im having a small problem... the tab creates sucesfully but when I click on it and enter the section, the navbar selected it still on "Forum" instead of the section I want.

How could I change this D:??

Lynne
05-01-2010, 09:45 PM
Hi there Im having a small problem... the tab creates sucesfully but when I click on it and enter the section, the navbar selected it still on "Forum" instead of the section I want.

How could I change this D:??
You need to have the condition set correctly for your tab to show as 'active'. What condition are you using?

Jonas Clark
05-03-2010, 06:34 PM
I want to use this to put navlinks before the Home tab and then rename the hometab to CMS or Community.

How do I do this?

Thanks

Lynne
05-03-2010, 11:01 PM
Make sure you pick the appropriate template_hook location to put the tab before the Home tab. You may have to change the order on it to put it before or after the Home tab.

Jonas Clark
05-04-2010, 02:07 PM
--------------- Added 1272985806 at 1272985806 ---------------

Make sure you pick the appropriate template_hook location to put the tab before the Home tab. You may have to change the order on it to put it before or after the Home tab.
Hi Lynne,

I'm a complete novice... can you show me how?
I used $template_hook['navtab_start']

Lynne
05-04-2010, 05:22 PM
--------------- Added 04 May 2010 at 08:10 ---------------


Hi Lynne,

I'm a complete novice... can you show me how?
I used $template_hook['navtab_start']
OK, and what was the result? And have you tried changing the execution order of the plugin?

Jonas Clark
05-05-2010, 04:49 PM
So the executing order is 5, should it be 1? If so... how do I rename Home (for the CMS frontpage tab) to Articles?

Lynne
05-05-2010, 06:10 PM
So the executing order is 5, should it be 1? If so... how do I rename Home (for the CMS frontpage tab) to Articles?
Try 1 and see.

Edit the phrase "site" to change "Home"

mclarens
05-07-2010, 10:16 PM
Hey Lynne, great tread, can finaly add links to my nav bar.

This might be abit offtopic but, i was thinking to change my "Home" button on the navbar to another side and been searching around without no exacly explainable answer how to to do that.
Do you know how to do that or where i can find the answer on that? :)

Lynne
05-07-2010, 10:27 PM
Hey Lynne, great tread, can finaly add links to my nav bar.

This might be abit offtopic but, i was thinking to change my "Home" button on the navbar to another side and been searching around without no exacly explainable answer how to to do that.
Do you know how to do that or where i can find the answer on that? :)
Just change the template_hook it is using. Plugin - Navbar: Insert CMS Navbar Entry

mclarens
05-08-2010, 09:16 AM
ahh thanks alot :)

mordor1
05-10-2010, 04:42 PM
I got it working for 1 link but now i want to make one for the FAQ too


Plugin PHP Code
$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'faq.php')
{
$vbulletin->options['selectednavtab']='faq_ftn';
$tabselected = ' class="selected"';
$tablinks = ' <ul class="floatcontainer">
<li><a href="faq.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> ';

}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="faq.php">FAQ</a>'.$tablinks.'</li>' ;



The link Faq is not highlighted now when its selected

Lynne
05-10-2010, 07:33 PM
This is not valid for the faq page:
if (THIS_SCRIPT == 'faq.php')

Open the file faq.php and find what THIS_SCRIPT is defined to be at the top.

Jonas Clark
05-10-2010, 09:25 PM
Thanks Lynne, Everything worked great... execution controls order of tab.

mordor1
05-11-2010, 05:46 PM
This is not valid for the faq page:
if (THIS_SCRIPT == 'faq.php')

Open the file faq.php and find what THIS_SCRIPT is defined to be at the top.

thx its faq without .php .... :o

Bansheebob
05-18-2010, 04:57 PM
I cant believe we have to go through all this to add simple links to a navbar. What the hell? I dont know how to do all this. Make my own plugin, your kidding right? Now I'm gonna have to pay someone to add a few links to my navbar, unlike 3.8 where it was as easy as a simple template edit/addition. Unreal. I'm starting to see why people are going back to the old vb forums.

cellarius
05-18-2010, 05:04 PM
I cant believe we have to go through all this to add simple links to a navbar. What the hell? I dont know how to do all this. Make my own plugin, your kidding right? Now I'm gonna have to pay someone to add a few links to my navbar, unlike 3.8 where it was as easy as a simple template edit/addition. Unreal. I'm starting to see why people are going back to the old vb forums.
I can understand your frustration, but a thread where a volunteer took the time to explain what is clearly too difficult is not the place to vent, really. Lynne or her tutorial are not to be blamed for this.

Bansheebob
05-18-2010, 05:07 PM
I wasnt blaming Lynne, she actually helped me yesterday with another issue. Just frustrated because on 3.8 I could edit anything in templates very easily and now in vb4 it's like you need a college course. They say in another thread "find this code" in navbar template and I look and its not even there in my code. I cant win today, starting to dislike vb4 bigtime.

Wilfred1
05-19-2010, 11:31 PM
Lynne - thank you for this and I have played around with it and with some small changes to suit my needs it works well.

But I would like to add that I am having an issue with this whole new navbar setup for v4 especially given that the navbar is the most changed component, in my opinion, in vb.

I use a navbar that is very similar to the new v4 one except with the added functionality of being able to hover on a tab and access the submenu of that tab for a set millisecond time before it bounces back to the currently selected tab.

To do this I have to set the criteria for its use when using v3.8.5:
<script type="text/javascript">
<if condition="in_array(THIS_SCRIPT, array('adv_index', 'about', 'sendmessage','support','staff','memberlist','onli ne', 'private', 'register'))">tabmenu.definemenu("menu", 0)</if>
<if condition="in_array(ADV_DYNA_PREFIX, array('aircraft', 'acnotice'))">tabmenu.definemenu("menu", 1)</if>
<if condition="in_array(THIS_SCRIPT, array('aircraft_register', 'aircraft_types'))">tabmenu.definemenu("menu", 1)</if>
<if condition="in_array(THIS_SCRIPT, array('blog', 'blog_usercp'))">tabmenu.definemenu("menu", 2)</if>
<if condition="in_array(ADV_DYNA_PREFIX, array('clubs', 'download', 'terms'))">tabmenu.definemenu("menu", 3)</if>
<if condition="in_array(THIS_SCRIPT, array('calendar', 'view', 'vbgooglemaphse', 'links_index', 'quiz', 'weather', 'weather_arfor', 'weather_metar', 'weather_taf', 'weather_sigmet', 'flight_planner'))">tabmenu.definemenu("menu", 3)</if>
<if condition="in_array(THIS_SCRIPT, array('index', 'album', 'group', 'search', 'showthread', 'forumdisplay', 'newthread'))">tabmenu.definemenu("menu", 4)</if>
<if condition="in_array(ADV_DYNA_PREFIX, array('quotes'))">tabmenu.definemenu("menu", 5)</if>
<if condition="in_array(THIS_SCRIPT, array('arcade', 'gallery_index', 'gallery_upload', 'gallery_search', 'gallery_slideshow', 'gallery_albums', 'gallery_edit', 'gallery_delete', 'vbtubepro', 'youtube_browser'))">tabmenu.definemenu("menu", 5)</if>
<if condition="in_array(THIS_SCRIPT, array('profile', 'member', 'subscription'))">tabmenu.definemenu("menu", 6)</if>
<if condition="ADV_DYNA_PREFIX == 'classifi'">tabmenu.definemenu("menu", 8)</if>
<if condition="$pg=='advertising_rates'">tabmenu.definemenu("menu", 0)</if>
</script>

Following this criteria are all the different sub menus which are listed as ul and li's.

As you can see it is a "dogs breakfast" of an array and trying to convert this to a more vb way using your great tutorial here is really, for me, going from one "dog's breakfast" to another.

So I raise this question...there must be a better way for everyone to manage their v4 navbar?

Could a global variable be created and:
- each time a user clicks a tab or submenu item the global variable is set to a number to correspond to the tab id
- the page changes to the linked page
- the tab that corresponds to the global variable is then made "selected"

Very little code would be needed to facilitate this, you wouldn't need to worry about "THIS SCRIPT" or any other definition of what page is being displayed, very simple to include a setting of the global variable on clicking, and then reading the variable on page display etc.

Is this an option? Would it make the navbar easier to manage? Would it improve performance? :confused:

Lynne
05-20-2010, 03:27 AM
I don't know if it would be easier to manage. On my site, I only want to add one or two more tabs and so it's no problem for me to do it the way everything is currently set up. I find it pretty simple the way it is, so I've never looked into an 'easier' method.

Lynk
05-24-2010, 09:12 PM
Now that I've gone through all of the work, I hope this helps someone on here. A while back, I created two new tabs (Home and Groups) over at http://www.drzforums.com, and just replicated the navlinks from the Forums navtab. The result was a set of broken links for visitors, since some of the navlinks require registration.

Today, I converted the navlinks conditional statements from the vB-specific HTML found in navheader, into the PHP required for a plug-in. Here is the plug-in code for my Groups tab:

$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'group')
{
$vbulletin->options['selectednavtab']='navtablabel_groups';
$tabselected = ' class="selected"';
$tablinks = '<ul class="floatcontainer">'.$template_hook['navbar_start'];

if ($show['searchbuttons']) {
if ($show['member'])
$tablinks .= '<li><a href="search.php?'.$session['sessionurl'].'do=getnew&amp;contenttype=vBForum_Post">'.$vbphrase['new_posts_nav'].'</a></li>';
else
$tablinks .= '<li><a href="search.php?'.$session['sessionurl'].'do=getdaily&amp;contenttype=vBForum_Post">'.$vbphrase['todays_posts'].'</a></li>';
}

$tablinks .= $template_hook['navbar_after_getnew'];

if ($show['pmmainlink'])
$tablinks .= '<li><a href="private.php'.$session['sessionurl_q'].'" rel="nofollow">'.$vbphrase['private_messages'].'</a></li>';

$tablinks .= $template_hook['navbar_after_pm'].'<li><a rel="help" href="faq.php'.$session['sessionurl_q'].'" accesskey="5">'.$vbphrase['faq'].'</a></li>'.$template_hook['navbar_after_faq'].'<li><a href="calendar.php'.$session['sessionurl_q'].'">'.$vbphrase['calendar'].'</a></li>'.$template_hook['navbar_after_calendar'].'<li class="popupmenu"><a href="javascript://" class="popupctrl" accesskey="6">'.$vbphrase['community'].'</a><ul class="popupbody popuphover">'.$template_hook['navbar_community_menu_start'];

if ($show['quick_links_groups'])
$tablinks .= '<li><a href="group.php'.$session['sessionurl_q'].'">'.$vbphrase['social_groups'].'</a></li>';

if ($show['quick_links_albums'])
$tablinks .= '<li><a href="album.php'.$session['sessionurl_q'].'">'.$vbphrase['pictures_and_albums'].'</a></li>';

if ($bbuserinfo['userid']) {
$tablinks .= '<li><a href="profile.php?'.$session['sessionurl'].'do=buddylist">';

if ($show['friends_and_contacts'])
$tablinks .= $vbphrase['contacts_and_friends'];
else
$tablinks .= $vbphrase['contacts'];

$tablinks .= '</a></li>';
}

if ($show['memberslist'])
$tablinks .= '<li><a href="memberlist.php'.$session['sessionurl_q'].'">'.$vbphrase['members_list'].'</a></li>';

$tablinks .= $template_hook['navbar_community_menu_end'].'</ul></li>'.$template_hook['navbar_after_community'].'<li class="popupmenu"><a href="javascript://" class="popupctrl">'.$vbphrase['forum_actions'].'</a><ul class="popupbody popuphover"><li><a href="forumdisplay.php?'.$session['sessionurl'].'do=markread">'.$vbphrase['mark_forums_read'].'</a></li>';

if ($show['member'])
$tablinks .= '<li><a href="profile.php?'.$session['sessionurl'].'do=editoptions">'.$vbphrase['edit_options'].'</a></li><li><a href="profile.php?'.$session['sessionurl'].'do=editprofile">'.$vbphrase['edit_your_details'].'</a></li>';

$tablinks .= '</ul></li><li class="popupmenu"><a href="javascript://" class="popupctrl" accesskey="3">'.$vbphrase['quick_links'].'</a><ul class="popupbody popuphover">';

if ($show['member']) {

if ($show['member'])
$tablinks .= '<li><a href="subscription.php'.$session['sessionurl_q'].'" rel="nofollow">'.$vbphrase['subscribed_threads'].'</a></li>';

$tablinks .= '<li><a href="javascript://" onclick="window.open(getBaseUrl() + \'misc.php?'.$session['sessionurl'].'do=buddylist&amp;focus=1\',\'buddylist\',\'statusbar =no,menubar=no,toolbar=no,scrollbars=yes,resizable =yes,width=250,height=300\'); return false;">'.$vbphrase['open_contacts'].'</a></li>';

if ($vboptions['forumleaders']) {
$tablinks .= '<li><a href="showgroups.php'.$session['sessionurl_q'].'" rel="nofollow">';

if ($vb_suite_installed)
$tablinks .= $vbphrase['view_site_leaders'];
else
$tablinks .= $vbphrase['view_forum_leaders'];

$tablinks .= '</a></li>';

}

}

$tablinks .= $template_hook['navbar_quick_links_menu_pos1'].$template_hook['navbar_quick_links_menu_pos2'].$template_hook['navbar_quick_links_menu_pos3'];

if ($show['wollink'])
$tablinks .= '<li><a href="online.php'.$session['sessionurl_q'].'">'.$vbphrase['whos_online'].'</a></li>';

$tablinks .= $template_hook['navbar_quick_links_menu_pos4'].'</ul></li>'.$template_hook['navbar_end'].'</ul></li>';
}

$template_hook['navtab_middle'] .= '<li'.$tabselected.'><a class="navtab" href="group.php">Groups</a>'.$tablinks.'</li>' ;

Enjoy! :cool:

Lionel
05-27-2010, 02:16 AM
how do you check permissions at that hook?

$cando = $permissions['myproduct'] & $vbulletin->bf_ugp['myproduct']['cando'] ? true : false;

is not doing anything.

edit ... found answer in blogs

GriZzm0
05-27-2010, 08:11 AM
Thanks. Using this for one of my subforums (kind of like the tabs here at vB.org). However, instead of forumdisplay.php?{vb:raw session.sessionurl}2-Main-Forum I would like to generate 2-Main-Forum using the vBulletin link generator so it takes the current rewrite rules into consideration. Any ideas how I would do that?

Hippy
06-01-2010, 09:55 PM
Lynne can this be used to make a simple navtab with out the drop down and sub links in the lower navbar ?

thanks

Lynne
06-02-2010, 03:48 AM
Lynne can this be used to make a simple navtab with out the drop down and sub links in the lower navbar ?

thanks
I would guess you could leave the submenu (and thus dropdown) out of it.

Hippy
06-02-2010, 08:49 PM
thanks

AfterWorldForum
06-04-2010, 04:14 PM
I cannot seem to get the plugin to accept a userid in the menu. I'm probably overlooking something obvious, but here's my code:


$tablinks .= '<li><a href="tracker.php?'. $session['sessionurl'] . '&do=search&userid=' .
$bbuserinfo['userid'] . '">


In the page defined in the plugin (tracker), I do have the line to include the vB stuff:

require_once('./global.php');

I tried putting an if ($bbuserinfo[userid]) block around the statement above, but that doesn't show any links. I even tried adding a $vbulletin->bbuserinfo in front of it, but again, no luck.

Any ideas what I might be doing wrong or overlooking?

Thanks :)

Lynne
06-04-2010, 05:12 PM
Try


$tablinks .= '<li><a href="tracker.php?'. $session['sessionurl'] . '&do=search&userid=' .$vbulletin->userinfo[userid]. '">

AfterWorldForum
06-04-2010, 06:22 PM
Try


$tablinks .= '<li><a href="tracker.php?'. $session['sessionurl'] . '&do=search&userid=' .$vbulletin->userinfo[userid]. '">


You are wise in the ways of plugins, Lynne :D Much obliged :hattip:

AliceHoward
06-06-2010, 08:35 AM
Hi Lynne,

I am wondering if there is anyway for me to use this great tutorial.

I want to be able to use this even though I do not have a custom page, I have my forumhome split to keep style download forums out of my main forums. I have do this using a really old mod by amykhar.

My forums for style downloads are located on forum.php?page=2, there isn't a this script defined anywhere so I cannot use one to get the tab higlighted or the pop-up menus to appear.

This is how I have my plugin written:
$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'forum.php?page=2')
{
$vbulletin->options['selectednavtab']='style_forums';
$tabselected = ' class="selected"';
$tablinks = ' <ul class="floatcontainer">
<li class="popupmenu">
<a href="javascript://" class="popupctrl">The vB3 Styles</a>
<ul class="popupbody popuphover">
<li><a href="forumdisplay.php?11-Download-vB3-Lighter-Styles">Download vB3 Lighter Styles</a></li>
<li><a href="forumdisplay.php?16-Download-vB3-Dark-Styles">Download vB3 Dark Styles</a></li>
<li><a href="project.php?projectid=2">Project vB Styles Version 3.8x</a></li>
</ul>
</li>
<li class="popupmenu">
<a href="javascript://" class="popupctrl">The vB4 Styles</a>
<ul class="popupbody popuphover">
<li><a href="forumdisplay.php?10-Download-vB4-Styles">Download vB4 Styles</a></li>
<li><a href="project.php?projectid=3">Project vB Styles Version 4</a></li>
</ul>
</li>
<li class="popupmenu">
<a href="javascript://" class="popupctrl">Loyal Member Styles</a>
<ul class="popupbody popuphover">
<li><a href="forumdisplay.php?22-Loyal-Member-vB4-Styles">Loyal Member vB4 Styles</a></li>
<li><a href="project.php?projectid=4">Project vB4 Styles Loyal Members</a></li>
</ul>
</li>
</ul> ';

}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="forum.php?page=2">Styles Forums</a>'.$tablinks.'</li>' ;

In use here:
http://www.styleorigin.com/vbstyles/forum.php

The link navigates to the page well enough but obviously the tab doesn't higlight and the pop-up menus do not appear. I know this is because of the incorrect use of the THIS_SCRIPT, but I don't know what to use instead.

Do you have any ideas please?

Lionel
06-06-2010, 09:15 AM
@Alice. Have you tried if(THIS_SCRIPT == 'index' AND $_REQUEST['page'] == 2) ?

wonderfulwat
06-06-2010, 09:49 AM
Hi, great site! I need some help.

When I unselect "Sections to Display in the Navbar Sub-Menu" I end up losing the Home tab. Is there any way to keep the Home tab present? It remains on every other screen (ie. when I'm in the forums - screenshots attached). My site is: www.wonderfulwaterloo.com if you want to check out the error.

I imagine it has something to do with this, and I tried to play around with it but the forum stopped working.

Edit Plugin Navbar: Insert CMS Navbar Entry

if (defined('CMS_SCRIPT') AND class_exists('vBCms_Navbar'))
{
$vbulletin->options['selectednavtab'] = 'vbcms';
$template_hook['navtab_start'] .= vBCms_NavBar::renderView();
}
else
{
$template_hook['navtab_start'] .= vB_Template::create('vbcms_navbar_link')->render();
$template_hook['navbar_getnew_menu'] .= vB_Template::create('vbcms_navbar_whatsnew_link')->render();
}

AliceHoward
06-07-2010, 07:00 AM
@Alice. Have you tried if(THIS_SCRIPT == 'index' AND $_REQUEST['page'] == 2) ?

Oh you darling, that works wonderfully well, thank you ever so much sweetie. :)

Wormy!
06-29-2010, 08:16 AM
Hmmm... how/where do I do that? Please :)

I'm trying to get the standard highlight/floating bar which shows above the tab...

Thank you!!

--------------- Added 1264124054 at 1264124054 ---------------

If I follow your tutorial... should that not be the case? Apologies for all the questions...

Hi Lynne

Appreciate all of your help... and I have all working bar one last thing...

When a user lands on my home page (by clicking on the new 'HOME' button I created), the highlighted button remains as the 'FORUMS' button? If they are on the home page, I would like them to see the 'HOME' button (which is the one I created with your mod) to be highlighted.

Are you able to help me work out this last aspect pls?

Cheers
Wormy

Lynne
07-01-2010, 03:19 PM
If your custom tab is not getting highlighted, then you probably don't have your condition for it written correctly. As I specified, that condition MUST be unique or it won't work.

Wormy!
07-02-2010, 10:06 AM
Hi Lynne

It is unique... and that's what's puzzling me 8|

It ighlights when it mouse overs... no problem there... BUT when a user clicks on the 'Home' tab and is directed there... the 'Forums' tab still remains as the highlighted option?

Does that make sense?

Thanks in advance!!

Lynne
07-02-2010, 02:24 PM
What is that unique condition?

Wormy!
07-02-2010, 08:30 PM
Hi Lynne

Heres my code:

$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'home_tab')
{
$vbulletin->options['selectednavtab']='home_tab';
$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> ';

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

Appreciate your help!

pant
07-02-2010, 08:41 PM
Has anyone posted how to get the 'quick links' drop down on every page yet?

Lynne
07-03-2010, 03:37 PM
Hi Lynne

Heres my code:

$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'home_tab')
{
$vbulletin->options['selectednavtab']='home_tab';
$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> ';

}
$template_hook['navtab_start'] .= '<li'.$tabselected.'><a class="navtab" href="http://www.technologyatplay.com">Home</a>'.$tablinks.'</li>' ; Appreciate your help!

And you defined THIS_SCRIPT to be "home_tab" where? That is not a default definition, so you would have needed to actually go define it manually somehow. If you are trying to do the content.php page, then if you look at the top of that page, you will see that THIS_SCRIPT is defined as "vbcms", not "home_tab".

Wormy!
07-03-2010, 09:41 PM
I'm going to sound slow here... but you've kind of lost me :(

I am using vBadvanced CMPS. I'm not exectly sure where I get the specific details for "THIS_SCRIPT"

I've looked in the page sourece code and I can't identify anything that looks like how the page is defined?

Sorry for my slow uptake on this... I doo aprreciate your help!

--------------- Added 1278197941 at 1278197941 ---------------

Bingo!! Got it!!

Doh! I edited the main index page and found the "THIS_SCRIPT" and we are off and running :)

Seriously... thanks SO much for your help!!!

--------------- Added 1278199197 at 1278199197 ---------------

Hi Lynne

Just a quick query... now that i have that in place, is there any way of getting the default forum settings to appear 'under' the Nav?

ie: * New Posts
* Private Messages
* FAQ
* Calendar
* Community
o Groups
o My Albums
o Friends & Contacts
o Member List
* Forum Actions
o Mark Forums Read
o General Settings
o Edit Profile
* Quick Links
o Subscribed Threads
o Open Contacts Popup
o View Forum Leaders
o Who's Online

Cheers

--------------- Added 1278200287 at 1278200287 ---------------

Another self answered question... I just recreate my own within your code!! Doh!

All done :)

Rebecca217
07-16-2010, 12:31 PM
This worked great for me. Thank you! :)

Lostboyfan
08-11-2010, 01:18 AM
I was wondering? Is it possible for this tab to go in front of the forum tab. I'm going to call it "Home" and link it with my vbadvanced page.

If anyone can help please write back soon.

Lynne
08-11-2010, 01:34 AM
I was wondering? Is it possible for this tab to go in front of the forum tab. I'm going to call it "Home" and link it with my vbadvanced page.

If anyone can help please write back soon.
As I wrote in the article:
You may use a different template_hook here - it just depends on where you want your tab to be - navtab_start and navtab_middle are also available.
You may also change the execution order if needed if two tabs are using the same hook and you want one to go before the other.

Lostboyfan
08-11-2010, 03:27 AM
As I wrote in the article:

You may also change the execution order if needed if two tabs are using the same hook and you want one to go before the other.

Ok thank you. It worked. Must of missed that part.

Tahooma
08-11-2010, 11:52 AM
If someone is using this and has the problem that the Homepage is selected, i modiefied the first line of vbcms_navbar_link to
<vb:if condition="$vboptions['selectednavtab'] == 'vbcms' AND !in_array($_GET['r'], array(60))">
Where 60 is the section id (e.g. content.php?60)

Hope this works for you

--------------- Added 1281531651 at 1281531651 ---------------

Only one more question:
I have new NavTabs to Content Sections (e.g. content?=60) called News.
Below that i have sub-nav links to content?=61 "Sports", content?=62 "Travel",...

Now all this works fine, all are displayed and you can follow the link.
Only problem is:


If i hit one of the subNavs, "News" loses the Highligthing (Selection) and none of the Navbar is selected.
Is there a way to have News Selected when using one of its sublinks ?

OK
Got it myself

$tabselected = '';
$tablinks = '';

if ((($_GET['r'] == 67) || ($_GET['r'] == 68) || ($_GET['r'] == 70))&& (THIS_SCRIPT == 'vbcms'))
{
$vbulletin->options['selectednavtab']='content.php?r=67';
$tabselected = ' class="selected"';
$tablinks = ' <ul class="floatcontainer">
<li><a href="content.php?r=68">Fotos</a></li>
<li><a href="content.php?r=70">Videos</a></li>
</ul> ';

This works well, just add the sub navs into your If. v 4.0.5


Thanks in advance

pedrossi
08-13-2010, 05:40 PM
Hi Lynne,

First of all thanks for all the help and the great article. Is there a way to create a new tab that links to the user's profile? For example the tab would be called "My Profile" and when the user clicks on it, it would take him to his profile as seen in member.php. On my forum, my user ID is "1", so the link would be www.myforum.com/member.php?1. But how do I do that through the plugin code? That is, how do I write a condition that only lets that tab show if the user is logged in, and to customize the link to be different for each user?

I know that the vb command {vb:link member, {vb:raw bbuserinfo}} generates the user-ID and username, and adding the output of that after member.php? takes me to the profile. But I tried doing something like this:
<a href="member.php?{vb:link member, {vb:raw bbuserinfo}}"> yet it didn't work.

Thanks!

cellarius
08-13-2010, 05:57 PM
No need for the member.php? in front of the variable - it contains the complete link, including the path and file.

Just try
<a href="{vb:link member, {vb:raw bbuserinfo}}">{vb:rawphrase your_profile}</a>

pedrossi
08-13-2010, 07:42 PM
No need for the member.php? in front of the variable - it contains the complete link, including the path and file.

Just try
<a href="{vb:link member, {vb:raw bbuserinfo}}">{vb:rawphrase your_profile}</a>

When I tried to implement this code into the plugin code Lynne provided, it seems vBulletin isn't 'parsing' (is this the right term?) the code. So what I end up with is a tab called {vb:rawphrase your_profile}, and instead of taking me to http://myforum.com/member.php?1-username it takes me to http://myforum.com/{vb:link member, {vb:raw bbuserinfo}}. Any ideas on how to get vBulletin to parse the {vb} tags inside a plugin?

Thanks!

Lynne
08-13-2010, 07:54 PM
You need to use php in a plugin. {vb:template stuff} is not php. You need to use actual $variables.

pedrossi
08-13-2010, 07:56 PM
You need to use php in a plugin. {vb:template stuff} is not php. You need to use actual $variables.

How can I get the results from the {vb:template stuff} into a PHP variable then? Or, how can I use PHP to figure out what the user's ID is? Still new to vb modding... :D

Lynne
08-13-2010, 07:59 PM
If you look in the php code, then you will see how to call out stuff using php. If you want *your* userid, then it would be $vbulletin->userinfo['userid'].

pedrossi
08-13-2010, 08:30 PM
Thanks, that worked!

Now to make it so that only logged in users can see the tab. I'm assuming $vbulletin->userinfo['userid'] returns either empty or '0' if the user isn't logged in, so an if statement should do the job (hopefully) =)

--------------- Added 1281736840 at 1281736840 ---------------

In case anyone is interested, here is the code to add to a new vBulletin plugin which will create a conditional navbar tab. If the user is logged in, it displays a tab linking to his profile. If not, it displays a tab linking to the registration page (register.php).

Thanks Cellarius and Lynne for helping me figure it out!


$tabselected = '';
$tablinks = '';
$tabselected_nolog = '';
$tablinks_nolog = '';
if (THIS_SCRIPT == 'member')
{
$vbulletin->options['selectednavtab']='my_profile';
$tabselected = ' class="selected"';
$tablinks = ' <ul class="floatcontainer">
<li><a href="private.php">Inbox</a></li>
<li><a href="profile.php?do=editprofile">Edit Profile</a></li>
<li><a href="profile.php?do=editoptions">Account Settings</a></li>
<li><a href="profile.php?do=privacy">Privacy Settings</a></li>
</ul> ';

}
if (THIS_SCRIPT == 'register')
{
$vbulletin->options['selectednavtab']='sign_up';
$tabselected_nolog = ' class="selected"';
}

$userid = $vbulletin->userinfo['userid'];

if($userid == 0)
{

$template_hook['navtab_start'] .= '<li'.$tabselected_nolog.'><a class="navtab" href= "register.php">Sign Up</a>'.$tablinks_nolog.'</li>' ;

}else if($userid > 0){

$template_hook['navtab_start'] .= '<li'.$tabselected.'><a class="navtab" href= "member.php?'.$userid.'">My Profile</a>'.$tablinks.'</li>' ;

}

Boofo
08-14-2010, 10:32 PM
Thank you, Lynne, for the well thought out article. I have been trying to figure this out for 2 days now. You made it easy, young lady. ;)

For anyone interested, here is all you need to make a W3C button that will check the markup validation for whatever page of the site you are currently on.

$template_hook['navtab_end'] .= '<li><a class="navtab" href="http://validator.w3.org/check?uri=referer" target="_blank">W3C</a></li>';

pedrossi
08-15-2010, 09:08 PM
So I added a link to the user's private message inbox as a sublink to my new tab, but when I click on that it activates the "forum' tab instead of the new tab. Any ideas on what files I have to modify to get the new tab to be activated instead of the forum tab? I'm guessing I need to find a certain condition and change it?

Boofo
08-15-2010, 10:20 PM
It should stay with the new tab when it is clicked. Does the tab itself stay selected when you click it?

pedrossi
08-16-2010, 02:27 AM
It should stay with the new tab when it is clicked. Does the tab itself stay selected when you click it?

Yep, it does. I'm thinking it has to do with all that THIS_SCRIPT business, and that there is piece of code that's telling the Forum tab to select itself if I am on the inbox page... but I need to find that piece of code and change it so that it instead selects the New Tab. I could be wrong, though...

I'm thinking I could add a condition to the plugin that says the new tab should be selected if THIS_SCRIPT is the inbox, but that would create a conflict and both the new tab and the forum tab would select themselves, causing a big mess.

Boofo
08-16-2010, 03:20 AM
Any sub-link you add needs to be under the navbar button you want to user it with. Like you did with the My Profile code.

pedrossi
08-16-2010, 05:37 AM
Any sub-link you add needs to be under the navbar button you want to user it with. Like you did with the My Profile code.

Here's what I've got right now:

http://cl.ly/20PD
(http://cl.ly/20PD)

When I click the "My Profile" tab, it becomes selected and it shows the right sub-links. "Career Talk" is what I have renamed my "Forum" tab to.

When I click on the sub-link "Inbox", though, it takes the user to the private messages page, but now the "Career Talk" tab becomes selected:

http://cl.ly/20N6

And here is my code:

$tabselected = '';
$tablinks = '';
$tabselected_nolog = '';
$tablinks_nolog = '';
if (THIS_SCRIPT == 'member')
{
$vbulletin->options['selectednavtab']='my_profile';
$tabselected = ' class="selected"';
$tablinks = ' <ul class="floatcontainer">
<li><a href="private.php">Inbox</a></li>
<li><a href="profile.php?do=editprofile">Edit Profile</a></li>
<li><a href="profile.php?do=editoptions">Account Settings</a></li>
<li><a href="profile.php?do=privacy">Privacy Settings</a></li>
</ul> ';

}
if (THIS_SCRIPT == 'register')
{
$vbulletin->options['selectednavtab']='sign_up';
$tabselected_nolog = ' class="selected"';
}

$userid = $vbulletin->userinfo['userid'];

if($userid == 0)
{

$template_hook['navtab_start'] .= '<li'.$tabselected_nolog.'><a class="navtab" href= "register.php">Sign Up</a>'.$tablinks_nolog.'</li>' ;

}else if($userid > 0){

$template_hook['navtab_start'] .= '<li'.$tabselected.'><a class="navtab" href= "member.php?'.$userid.'">My Profile</a>'.$tablinks.'</li>' ;

}

I'm slowly getting there, just need a push in the right direction :D

Boofo
08-16-2010, 06:05 AM
That is how it is supposed to work. When I go to private messages, my Forum tab is selected. Or am I missing what you are wanting to do?

pedrossi
08-16-2010, 06:21 AM
Yeah, I want the new tab to be selected when I go to private messages, rather than the Forum tab. Sorry if I wasn't clear before.

cellarius
08-16-2010, 06:38 AM
Yeah, I want the new tab to be selected when I go to private messages, rather than the Forum tab..
Change in your code:
if (THIS_SCRIPT == 'member')
to
if (THIS_SCRIPT == 'member' OR THIS_SCRIPT == 'private')

pedrossi
08-16-2010, 03:56 PM
Wow, so simple. That did it! I thought there would be a conflict, but I guess not?

Anyway, many thanks :)

Boofo
08-16-2010, 04:34 PM
Change in your code:
if (THIS_SCRIPT == 'member')
to
if (THIS_SCRIPT == 'member' OR THIS_SCRIPT == 'private')

Whew! Thanks for bailing me out once again, sir. ;)

cellarius
08-16-2010, 04:44 PM
Whew! Thanks for bailing me out once again, sir. ;)
Anytime ;)

Boofo
08-16-2010, 05:46 PM
I wasn't quite sure what he was wanting. Must have been the old age confusion creeping up on me. ;)

Boofo
08-18-2010, 10:52 PM
I found an easy way to make any new tabs have the same links under it as the forum tab does. If anyone is interested in how to do that, contact me and I will show you. You will also be able to add links in between the other links just like in the forum tab.

nlwin
08-31-2010, 09:46 PM
Is this plugin works in vBulletin 4.0.5? I tried it and it doesn't work for me. Any idea? :D

Lynne
09-01-2010, 12:07 AM
Yes, it works in 4.0.5.

NashChristian
09-12-2010, 07:39 PM
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).

Hello Lynne,

I've used your plugin here successfully for quite a while and love it! I'm now trying to rework my navigation to create drop-down menus on most of my TABS. I've tried Shelby's mod (referenced above) and I believe that YOURS is closer to meeting my needs, however I need some help adapting it.

Basically, what I want is ALL the functionality of your plugin PLUS the ability to include drop-down menus on the TABS themselves!

Problems with Shelby's Mod (for my needs):

I want the tab to stay highlighted once one of the options in that tab have been selected (like on yours).
I want to replace the tablinks (submenus) on each of the primary categories (like on yours).


For example, one of my TABS is for the EVENT CALENDAR:

EVENT CALENDAR

Monthly View
Weekly View
Add New Event


Then once any of those three links above, in the tab menu are selected, I want to have the Event Calendar button highlighted (show SELECTED same as vB default behavior), and have the standard Forum submenu (tablinks) replaced with one custom submenu that says "Add New Event". So this text link will appear alone in the upper left corner of the navigation submenu (under the row of tabs).

I've been playing with this all day, but can't seem to figure it out. I'm unsure whether it is NECESSARY to do this in two steps by creating the new template and plugin as suggested by Shelby. I don't mind either way, I just need help adapting one of the mods to include these features.

Any help would be appreciated!

Thanks!
:D Jeff

Lynne
09-12-2010, 08:52 PM
You are going to have to merge the two mods together. I'd suggest doing that and then starting your own thread where you post your code and images or your result (or a link to see it). That way, we can try out your code ourselves and see what is going on and make suggestions for changes.

NashChristian
09-12-2010, 10:31 PM
You are going to have to merge the two mods together. I'd suggest doing that and then starting your own thread where you post your code and images or your result (or a link to see it). That way, we can try out your code ourselves and see what is going on and make suggestions for changes.

Hello Lynne,

My concern with that is three fold:


I would be literally copying your code and Shelby's and combining the two, which I don't think I'm supposed to do without permisson from both parties.
People will ask me a bunch of questions that I'm not the slightest bit qualified to answer.
I've tinkered with this some already, and the part I can't figure out is how to have the selected tab highlighted (show SELECTED the same as vB default behavior). The plugin can be conditional, but I don't believe the template can. I'd need a way either to pass a value into the template (selected or not), or I'd need the plugin to route to two different templates depending upon whether it is selected or not. Multipy that times five different tabs, each with their own drop-down menu, and it seems that this could get quite resource intensive.


Your thoughts?

Thanks!
:D Jeff

Lynne
09-12-2010, 11:06 PM
1. No you wouldn't. You are simply taking our instructions and writing your own. I'm talking about putting in your own links and all that - post exactly what your plugin code currently is.

2. Ignore them or say "I don't know". It's a help thread - you are asking for help not offering help.

3. Post it. Tell us what isn't working. Tell us what the conditions are for the tab to be highlighted. You need to verbalize that anyway so you can write your condition for it.

NashChristian
09-13-2010, 12:01 AM
Ok, I misunderstood what you were saying.

What forum should I post the new help thread in?

Modification Requests/Questions (Unpaid)?
vB4 Design and Graphics Discussions?

Thanks again for your assistance!
Jeff

Lynne
09-13-2010, 12:13 AM
You could post it in here - vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251) (or vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252))

NashChristian
09-13-2010, 06:07 PM
You are going to have to merge the two mods together. I'd suggest doing that and then starting your own thread where you post your code and images or your result (or a link to see it). That way, we can try out your code ourselves and see what is going on and make suggestions for changes.

I've started a new thread HERE (https://vborg.vbsupport.ru/showthread.php?t=250426) for anyone who wants to follow or participate in the development of the modifications I've mentioned.

jacobskinner811
09-13-2010, 06:57 PM
hey lynn i am not a programer and am really bad at all this...is there a way i could pay you to install it on my site?

unknown22
09-16-2010, 07:55 PM
I put in the plugin code but it only creates a tab beside forum it's a link to another website
and there's no nav bar with menu.

$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'new site')
{
$vbulletin->options['selectednavtab']='hlstat';
$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> ';

}
$template_hook['navtab_middle'] .= '<li'.$tabselected.'><a class="navtab" href="http://website.com">name here</a>'.$tablinks.'</li>' ;

I was looking only to create a nav bar link like community you click that and members list etc..
Trying to make it under my home tab which has nothing under it, using vbadvanced.

Lynne
09-16-2010, 11:44 PM
I put in the plugin code but it only creates a tab beside forum it's a link to another website
and there's no nav bar with menu.
Since you are linking to another site, you will be on another site after you click the link and therefore it can't be highlighted.

unknown22
09-17-2010, 01:34 AM
It was a test because that other tutorial was for the tab I thought this was for the navbar like community, quick links. I like to have it as that won't work?? only the link as I said to another site shows up nothing under that.

Lynne
09-17-2010, 02:45 AM
It was a test because that other tutorial was for the tab I thought this was for the navbar like community, quick links. I like to have it as that won't work?? only the link as I said to another site shows up nothing under that.
If you read the first post, this is for the navtab and then contents in the sub-menu.

unknown22
09-17-2010, 12:20 PM
Either way if I try to add this under home does not work or navbar alone submenu won't show up.

if (THIS_SCRIPT == 'cmps_index.php')

home page, nothing shows up under there

$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'cmps_index.php')
{
$vbulletin->options['selectednavtab']='hometemplate';
$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="http://blackpulsegamers.net/forums/forum.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> ';

}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="cmps_index.php">jjyj</a>'.$tablinks.'</li>' ;

Hook Location = process_templates_complete

Execution Order = 10 and I have another mod which uses Execution Order 8 and both tabs switch for some reason. Roster is the second last tab before this one.

Even If I try to make a tab alone nothing shows up under it.

Lynne
09-17-2010, 01:43 PM
I'm not positive, but I don't think this is valid:
if (THIS_SCRIPT == 'cmps_index.php')

I don't think THIS_SCRIPT is defined as cmps_index.php on that page. Open the file and see what it says (you shouldn't guess, you need to Look At The Code).

unknown22
09-18-2010, 03:11 PM
How could i add links sub menu etc.. under my home tab which theres nothing under that used vbadvanced for that.

Lynne
09-18-2010, 06:01 PM
How could i add links sub menu etc.. under my home tab which theres nothing under that used vbadvanced for that.
You would have to edit the plugin that is creating that tab for you.

mailshuxin
10-13-2010, 02:07 AM
Very easy to use
It great,I used on my vb

PankajKumar
10-24-2010, 01:24 PM
Hi Lynne,

I want to have this in my forum and added following code as a plugin

$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'webmaster tools')
{
$vbulletin->options['selectednavtab']='tools';
$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> ';

}
$template_hook['navtab_middle'] .= '<li'.$tabselected.'><a class="navtab" href="http://www.awebmastersforum.com/cmps_index.php?pageid=tools">Tools</a>'.$tablinks.'</li>' ;

Now the issues I am facing are;

1. On clicking of "Tools" tab, Forum is getting highlighted which should be Tools.
2. No sub-menus are getting shown, I think its because of first issue. If that will be fixed, it should automatically get fixed.

You can check this at my forum: Webmaster Forum (http://www.awebmastersforum.com)

I am not sure what is the issue with my code. I searched in all the 24 pages of the thread but didn't find the solution. Please help me out.

--------------- Added 1287931785 at 1287931785 ---------------

Hi,

On further debugging, after clicking on "Tools" tab, i checked the page source and found this:


var THIS_SCRIPT = "adv_index";

Now my question is that where are we setting this variable in the plugin code? Obviously, I am missing some small details which is causing this issue and the variable is not getting set properly and hence default Forum tab is getting highlighted.

Please let me know where does it get set? I am new to VB, so it will take some time to get used to it.

Lynne
10-24-2010, 02:10 PM
If the page you are clicking on has THIS_SCRIPT defined as 'adv_index', then 'adv_index' is what you need to put into the plugin. The plugin has the condition for when the tab is highlighted.

PankajKumar
10-24-2010, 02:39 PM
If the page you are clicking on has THIS_SCRIPT defined as 'adv_index', then 'adv_index' is what you need to put into the plugin. The plugin has the condition for when the tab is highlighted.

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.

lowchia
10-29-2010, 04:24 PM
Hi Lynne

Thanks for helping us but after reading so much, my knowledge only increase by abit :(

My forum is at http://singstocks.com/forum

I just need to add a "Home" tab at nav bar: Home --> Forum --> What news

This home tab is a link back to my blog at http://singstocks.com.

Pls help and explain clearly as i am new at codes.

Thank you

<div id="navbar" class="navbar">

<ul id="navtabs" class="navtabs floatcontainer<vb:if condition="$show['member'] AND $notifications_total"> notify</vb:if>">
{vb:raw template_hook.navtab_start}
<vb:if condition="!$vboptions['selectednavtab'] AND THIS_SCRIPT != 'search'">
<li class="selected"><a class="navtab" href="{vb:raw vboptions.forumhome}.php{vb:raw session.sessionurl_q}">{vb:rawphrase forum}</a>
<ul class="floatcontainer">
{vb:raw template_hook.navbar_start}
<vb:if condition="$show['searchbuttons']">
<vb:if condition="$show['member']">
<li><a href="search.php?{vb:raw session.sessionurl}do=getnew&amp;contenttype=vBForum_P ost">{vb:rawphrase new_posts_nav}</a></li>
<vb:else />
<li><a href="search.php?{vb:raw session.sessionurl}do=getdaily&amp;contenttype=vBForum _Post">{vb:rawphrase todays_posts}</a></li>
</vb:if>
</vb:if>
{vb:raw template_hook.navbar_after_getnew}
<vb:if condition="$show['pmmainlink']">
<li><a href="private.php{vb:raw session.sessionurl_q}" rel="nofollow">{vb:rawphrase private_messages}</a></li>
</vb:if>
{vb:raw template_hook.navbar_after_pm}
<li><a rel="help" href="faq.php{vb:raw session.sessionurl_q}" accesskey="5">{vb:rawphrase faq}</a></li>
{vb:raw template_hook.navbar_after_faq}
<li><a href="calendar.php{vb:raw

cassis2k
11-03-2010, 02:01 PM
If the page you are clicking on has THIS_SCRIPT defined as 'adv_index', then 'adv_index' is what you need to put into the plugin. The plugin has the condition for when the tab is highlighted.

Thank you Lynne, it's perfect :D

Lostboyfan
11-13-2010, 09:33 PM
How do I make a navbar tab stay highlighted with you click on it?

I would like to know as soon as possible

Hippy
11-14-2010, 11:26 AM
your answer is above your post

Lostboyfan
11-14-2010, 03:29 PM
your answer is above your post

Thanks for telling me. Must of been reading so many post that I finally just posted to get an answer and didn't know that it was right in front of me.

crtsoft
11-17-2010, 02:33 AM
Great post. simple, and works great. thanks

Dugchugger
11-29-2010, 01:55 AM
Thanks Lynne! It's Duggy-proof! I got it up and running in less than 5 mins. You are a vB Goddess!

sailnet
12-14-2010, 08:28 PM
I just installed this code exactly as it appears, and it shows up on my forums menus but the drop downs do not appear - any ideas why?

I'm running on 4.1.0

I would have preferred to go with the template version of this mod but there's nothing in the template version about creating drop downs and I need drop down on my additional menu items.

tdev1
12-19-2010, 06:58 PM
thanks for this tutorial, very nice :)

used to create a tutorial on how to embed webchat-IRC: http://thomasfischer.biz/?p=441

larryd
12-29-2010, 07:38 PM
I've added a tab called Features which works great thanks..

Question is now that I am calling custom vb pages that I'm creating from this tab how do I get the tab to be the highlighted tab?

For example in my custom VB page dynodb.php


define('THIS_SCRIPT', 'dynodb');
define(ncoextratab, true);


The forum template for the Features tab is called nco_extra_navbar and looks like this


<vb:if condition="$vboptions['selectednavtab'] == 'ncoextratab'">

<li style="border-top-style:solid; border-top-color:white; border-top-width:1px; border-left-style:solid; border-left-color:white; border-left-width:1px;" class="popupmenu">

<a style="text-decoration:none;" color='#ff0000'" href="javascript://" class="popupctrl" ><b>Features</b></a>

<ul class="popupbody popuphover">
<li><a href="http://www.newcelica.org">Install Guides</a></li>
<li><a href="http://partscatalog.newcelica.org/page.php">Parts Catalog</a></li>
<li><a href="http://tracktimes.newcelica.org/index.php">Track Times</a></li>
<li><a href="dynodb.php">Dyno Database</a></li>
<li><a href="http://www.newcelica.org/other/technical/index.htm">Technical Information</a></li>
<li><a href="http://www.newcelica.org/other/store/index.htm">NC.org Gear</a></li>
</ul>
</li>

<vb:else />

<li style="border-top-style:solid; border-top-color:white; border-top-width:1px; border-left-style:solid; border-left-color:white; border-left-width:1px;" class="popupmenu">

<a onmouseover="this.style.color='#ff0000'" onmouseout="this.style.color='#ffffff'" href="javascript://" class="popupctrl" ><b>Features</b></a>

<ul class="popupbody popuphover">
<li><a href="http://www.newcelica.org">Install Guides</a></li>
<li><a href="http://partscatalog.newcelica.org/page.php">Parts Catalog</a></li>
<li><a href="http://tracktimes.newcelica.org/index.php">Track Times</a></li>
<li><a href="dynodb.php">Dyno Database</a></li>
<li><a href="http://www.newcelica.org/other/technical/index.htm">Technical Information</a></li>
<li><a href="http://www.newcelica.org/other/store/index.htm">NC.org Gear</a></li>
</ul>
</li>

</vb:if>


The plugin hook calls nco_extra_navbar so why when I load my dynodb.php page does it not highlight the Features tab? It highlights the forums tab regardless of how I browse to the dynodb.php page

http://vb.newcelica.org/dynodb.php

Lynne
12-29-2010, 10:10 PM
This is the wrong place to ask about how to get the tab to highlight when using a template for your navtab. There is another article that talks about using a template for the navtab. This article only uses a plugin and the condition for highlighting the tab is in the plugin.

Monahan
01-16-2011, 10:41 PM
Absolutely brilliant Lynne, a big thanks.

I've looked all over the place for this. I don't know what other members problems are. I'm a novice but followed your instructions and it works, first time. Dead easy.

Thanks again.

Budget101
01-18-2011, 12:34 PM
Ugh, I've been at this for 14 hours straight and cannot get it to do what I want.

In the Navbar- I want to created a Navtab (that doesn't link to anything/go anywhere/ stays on the same page no matter what page you're on when you click it) but that creates a Navigation submenu bar with multiple drop down boxes containing links.

https://vborg.vbsupport.ru/external/2011/07/104.jpg

I want it to do this (as pictured above)- except that link 1 is a drop down, link 2 is a drop down, etc (all of the submenus are dropdowns. When you click on "Nav Link" in the navbar tabs- it doesn't actually GO anywhere- the page stays the same with the navigation menus all showing.

I got all of submenu dropdowns to show but cant get the 'Nav Link" to remain the same on every single page.

-------------------------------------------------------------------------

I tried using: $template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" >Nav Link</a>'.$tablinks.'</li>' ;

is there a way to remove the actual "Linking" of the tab and still have the drop down menu appear when someone clicks on it?

I tried using 'index' in THIS_SCRIPT and removing the link in the bottom line 'link.php' but than it overwrote the links in the forum tab (so when you click on the forum tab, the links from the new tab showed).


I just want a tab that when clicked on- displays the sections that are available on my site.

smooth-c
01-18-2011, 01:36 PM
Is it possible to have a background image for a tab? Would be great if anyone could help!

Thanks.

Greg

Lynne
01-18-2011, 07:07 PM
Is it possible to have a background image for a tab? Would be great if anyone could help!

Thanks.

Greg
Just add a class to the tab (where it says class="navtab" add in a class there) and then just define it in additional.css

Edrondol
01-19-2011, 07:03 PM
How would I add a conditional to the following?

<li class="popupmenu">
<a href="javascript://" class="popupctrl navtab" style="background:transparent url({vb:stylevar imgdir_misc}/arrow.png) no-repeat {vb:stylevar right} center; padding-right: 15px">Special Access</a>
<ul class="popupbody popuphover">
<li><a style="text-indent: 0px; color:{vb:stylevar navbar_selected_popup_body_a_Color}" href="http://domain.com/">TEST</a></li>
<li><a style="color:{vb:stylevar navbar_selected_popup_body_a_Color}" href="sublink2.php">SubLink 2</a></li>
<li><a style="color:{vb:stylevar navbar_selected_popup_body_a_Color}" href="sublink3.php">SubLink 3</a></li>
</ul>
</li>

Lynne
01-19-2011, 09:16 PM
Since that looks like just html, I'll assume it's a template, so just add:
<vb:if condition="whatever condition you want">
your code
</vb:if>
Your question is so general that I can't offer any specifics. (And, I don't know why it's here since there is no template in this article.)

LoveStream
01-23-2011, 11:09 AM
Hello, Lynne.

I have a question to you.

I made a NEW custom NavTabs with my own script files. And I add a PHP above menu you state into the plugin product too.

My edited template is "FORUMHOME".
I copied this FORUMHOME to new my custom as named "FORUMHOME_PJ" and create new mypj.php correspond to templates name and its values.

To modify certain template, really I want to show just one its nested childforum from the whole forum list, I added the <vb:if condition="........."></vb:if> in the top line of the copied templates.

Then now when I load my custom NAVTAB menu it works very well with my altered FORUMHOME_PJ templates and mypj.php.

However in this case, when I back to the tied forum that have IF, CONDITIONED tag to limit show the certain forum id, after I was browsing the thread title or link of limited forum, the NAVTAB menu won't point out my CUSTOM NAVTAB and it always turned to the basic forum TAB again. My NavTab menu doesn't highlighted which should be.

My purpose is that I always should fixed in my new NavTab menu.

To operate this I look at and refer to the /include/functions_forumlist.php and made a new functions_forumlist_pj.php that contains altered $forumbits_pj.

Can I ask to you?

I'm sorry for that my inaccurate expression.
I hope you understand it.

Thanks you.

Lynne
01-23-2011, 03:43 PM
I'm sorry, but I really have no idea what you are asking. If you want your navtab to show when you go to a certain page, you need to set up a unique condition. If that condition is not unique, then another navtab may show as highlighted.

LoveStream
01-24-2011, 05:35 AM
I'm sorry, but I really have no idea what you are asking. If you want your navtab to show when you go to a certain page, you need to set up a unique condition. If that condition is not unique, then another navtab may show as highlighted.

Thank you, but though I put unique name, navtab is back to old forum Tab.
I should be study more.

Thank you.

slosupra
01-25-2011, 03:46 AM
I am sorry if this question has been asked but how do i set the position of the tab weather it is in the first or lets say the third position..

thanks

dnk.it
01-25-2011, 05:28 PM
It is possible to open a link in a new browser ( popup ) ? I've tried to add this code but didnt work:

$tabselected = '';
$tablinks = '';

function trackPopup(href, target)
{
target = target || "_blank";
window.open(href, target,'width=300,height=500,resizable=0,scrollbar s=no,menubar=no,status=no');
pageTracker._link(href);
}

if (PP_SCRIPT == 'PP_Classifieds' )
{
$vbulletin->options['selectednavtab']='pp_market';
$tabselected = ' class="selected"';
}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="/page.html" target="popupWindow" onclick="trackPopup(this.href, this.target); return false;" onmousedown="top.status='Insert Message';" onmouseover="top.status='Insert Message';">Chat</a>'.$tablinks.'</li>' ;

I've also tried to put the javascript function in separate .js file and link it in header with <script> without success

Lynne
01-25-2011, 05:51 PM
Sorry, but I don't help with javascript issues.

dnk.it
01-25-2011, 08:42 PM
meanwhile I've solved it by myself :)

maybe it should be useful for somebody else in the future :

$tabselected = '';
$tablinks = '';

if (PP_SCRIPT == 'PP_CHAT' )
{
$vbulletin->options['selectednavtab']='pp_chat';
$tabselected = ' class="selected"';
}
$template_hook['navtab_end'] .= '<script language="JavaScript1.2">function openwindow()
{ mywindow=window.open("chatrooms/index.php","mywindow","location=0,status=0,menubar=0,resizable=1,width=65 0,height=500");
mywindow.moveTo(screen.width/2-300,screen.height/2-250);
}
</script><li'.$tabselected.'><a title="Chat" class="navtab" href="javascript: openwindow()">Chatroom</a>'.$tablinks.'</li>' ;

slosupra
01-26-2011, 06:55 PM
I am sorry if this question has been asked but how do i set the position of the tab weather it is in the first or lets say the third position..


thanks

anyone??

Lynne
01-26-2011, 10:05 PM
anyone??
This is answered in the article itself:
You may use a different template_hook here - it just depends on where you want your tab to be - navtab_start and navtab_middle are also available.

slosupra
01-27-2011, 05:24 PM
This is answered in the article itself:

Overlooked that thanks very much got it working now

Budget101
01-28-2011, 02:21 PM
Ugh, I've been at this for 14 hours straight and cannot get it to do what I want.

In the Navbar- I want to created a Navtab (that doesn't link to anything/go anywhere/ stays on the same page no matter what page you're on when you click it) but that creates a Navigation submenu bar with multiple drop down boxes containing links.

https://vborg.vbsupport.ru/external/2011/07/104.jpg

I want it to do this (as pictured above)- except that link 1 is a drop down, link 2 is a drop down, etc (all of the submenus are dropdowns. When you click on "Nav Link" in the navbar tabs- it doesn't actually GO anywhere- the page stays the same with the navigation menus all showing.

I got all of submenu dropdowns to show but cant get the 'Nav Link" to remain the same on every single page.

-------------------------------------------------------------------------

I tried using: $template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" >Nav Link</a>'.$tablinks.'</li>' ; is there a way to remove the actual "Linking" of the tab and still have the drop down menu appear when someone clicks on it?

I tried using 'index' in THIS_SCRIPT and removing the link in the bottom line 'link.php' but than it overwrote the links in the forum tab (so when you click on the forum tab, the links from the new tab showed).


I just want a tab that when clicked on- displays the sections that are available on my site.

No Answer, Really???????????????????????? :confused:

Lynne
01-28-2011, 03:06 PM
No Answer, Really???????????????????????? :confused:
I don't know how you would do that. You would need to come up with that "unique" condition, and I'm not sure what that would be. Figure that out, and it will work.

Kevlar21
01-29-2011, 07:57 AM
hi lynne, im a fan of your work..

so how do you remove the "forum" tab if you dont own the CMS forum suite version?

I managed to remove the "whats new" just cant manage to find where to remove the "forum" tab

cellarius
01-29-2011, 02:19 PM
No Answer, Really???????????????????????? :confused:
Yep, screaming at people will help, as will the inflationary use of question marks. I'm totally sure it will.

Lynne
01-29-2011, 02:38 PM
hi lynne, im a fan of your work..

so how do you remove the "forum" tab if you dont own the CMS forum suite version?

I managed to remove the "whats new" just cant manage to find where to remove the "forum" tab
This really is not the thread for that. This question has actually been asked a few times - have you tried a search? You'll have to edit the navbar template.

fireglow305
01-29-2011, 07:14 PM
Thx for this article ;)

frenchy232
01-31-2011, 08:12 PM
Great, worked for me, thank you....

www.mightcontainnuts.com/community

Pinto Pony
02-04-2011, 03:12 PM
Thanks Lynne! I gave this a try, my first attempt at creating a plugin for a tab to go with this mod cause the navbar tab it comes with never looked right or worked right for me.
https://vborg.vbsupport.ru/showthread.php?t=237931

Reading the 20+ pages of replies got me through it and I think I will give it a try on some other pages now!

Thanks for the tutorial :)

odln018
02-04-2011, 05:19 PM
I must be truly dumb, as I can't get this to work. I don't know what to use as a "link.php". Also, should the drop down appear if the link.php doesn't exist?

Stupid I'm sure.

Lynne
02-04-2011, 07:55 PM
I must be truly dumb, as I can't get this to work. I don't know what to use as a "link.php". Also, should the drop down appear if the link.php doesn't exist?

Stupid I'm sure.
link.php is whatever page you want to link the navtab to. And a dropdown where? The only dropdowns in this are ones you create yourself in the submenu if you choose to do that.

odln018
02-04-2011, 08:30 PM
I was wanting to create a tab, then when you clicked on that tab, you would get a dropdown.

Maybe I'm looking at the wrong article.

Lynne
02-04-2011, 08:39 PM
I was wanting to create a tab, then when you clicked on that tab, you would get a dropdown.

Maybe I'm looking at the wrong article.
This article helps create a tab like in the picture in the first post.

DuNkLeArChOn
02-05-2011, 03:12 PM
It works fine .. thanks :D

odln018
02-09-2011, 06:11 PM
Ok, I'm making progress with this.

What I'm trying to do is created a Special Access tab for those who have contributed and have access to more features of the site.

My link1.php page contains this:

define(SpecialAccess, true);

When I click on the Nav link, I want that tab to be highlighted, with items in the sub for "sub link 1", sublink 2", etc.

Here's my plugin code:


$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'Special')
{

$vbulletin->options['selectednavtab']='Special';
$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> ';

}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="link.php">Nav Link</a>'.$tablinks.'</li>' ;



When I click on the tab, I get taken directly to the contents of link1.php

Any corrections would be greatly appreciated.

Lynne
02-09-2011, 06:58 PM
You say that right now if you click on the tab, you get taken to link1.php. Isn't that what you want? I'm not understanding what the problem is that you are having.

And on link1.php, do you define THIS_SCRIPT?

wpeloquin
02-16-2011, 10:30 PM
Hello.

I just wanted to say that I used a hybrid between yours and ragtek's. It allows the base of the navtab to be stored in the plugin, with a couple of things that can be edited in the Admin->Options->Plugin, and offloads the submenu into a template that can be edited as needed by the end-user.

Plugin PHP:

$tabselected = '';
$tablinks = '';

$navtab_name = $vbulletin->options['plugin_navtab_title'];
$navtab_location = $vbulletin->options['plugin_navtab_location'];
Those are based on Options that i set up, so the user can choose title and location in the Admin->Options->Plugin Options

switch ($location) {
case '1':
$tabloc = 'navtab_end'; break;
case '2':
$tabloc = 'navtab_middle'; break;
case '3':
$tabloc = 'navtab_start'; break;
}
The above code determines which option was selected, 1/2/3, to determine location of navtab.

if (THIS_SCRIPT == 'rkc_plugin')
{
$vbulletin->options['selectednavtab']='rkc_plugin';
$tabselected = ' class="selected"';
$tablinks .= vB_Template::create('plugin_navbar_submenu')->render();

}
$template_hook[$nbloc] .= '<li'.$tabselected.'><a class="navtab" href="pluginpage.php">'.$navtabname.'</a>'.$tablinks.'</li>' ;


Template Code:

<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>

Boofo
02-16-2011, 10:55 PM
You ought to release that. ;)

Hippy
02-17-2011, 12:50 PM
You ought to release that. ;)
I'll second that:up:

Truth66
02-21-2011, 01:25 AM
To try and keep things simple, I just added a couple of tabs to the nav bar. The new tabs appear with the name that I want and are fully clickable to the link that I want.
However, when I click onto my new tab it highlights when it's supposed to and then when the new page appears, the tab is no longer highlighted after I move the cursor. The Forum tab automatically highlights, yet the page does not change to the Forum page.

This only happens with the new tabs that I created. I'm using v4.1.2

The tabs were created as a plugin and the hook location is process_templates_complete

Here's the html in the plugin that I used to create one of the new tabs:

$template_hook['navtab_middle'] .= '<li'.$tabselected.'><a class="navtab" href="http://www.voicescount.com/forumdisplay.php?589-Businesses-Sellers-Listings-U.S.A.-Nationwide-Statewide-and-by-American-Cities">U.S.A. Listings</a>'.$tablinks.'</li>';

Is there anything missing in this html?

Thanks Again

Lynne
02-21-2011, 02:59 AM
To try and keep things simple, I just added a couple of tabs to the nav bar. The new tabs appear with the name that I want and are fully clickable to the link that I want.
However, when I click onto my new tab it highlights when it's supposed to and then when the new page appears, the tab is no longer highlighted after I move the cursor. The Forum tab automatically highlights, yet the page does not change to the Forum page.

This only happens with the new tabs that I created. I'm using v4.1.2

The tabs were created as a plugin and the hook location is process_templates_complete

Here's the html in the plugin that I used to create one of the new tabs:

$template_hook['navtab_middle'] .= '<li'.$tabselected.'><a class="navtab" href="http://www.voicescount.com/forumdisplay.php?589-Businesses-Sellers-Listings-U.S.A.-Nationwide-Statewide-and-by-American-Cities">U.S.A. Listings</a>'.$tablinks.'</li>';

Is there anything missing in this html?

Thanks Again
You need to make sure that you wrote a valid, unique condition for when you tab is active - this is the example condition given and you will need to change it to be valid for your pages:
if (THIS_SCRIPT == 'yourpage')
That is just an example and your condition will most likely look totally different.

Truth66
02-21-2011, 08:07 PM
Hi Lynne,

I've spent countless hours on this today. In fact I've created three different plugins, using a different code fo each and tested each plugin seperately. All three plugins do the exact same thing. Yet all have the exact same problem. The problem is that the tab I create doesn't stay highlighted after a person clicks onto the tab. The tab that does stay highlighted after my new tab is clicked is the Forum tab.

Here's the three different types of code that I've tried:

Plugin A Code:

$template_hook['navtab_end'] = '<li><a class="navtab" href="forumdisplay.php?589">U.S.A. Listings';

Note: Plugin A Code was explained here:

https://vborg.vbsupport.ru/showthread.php?p=2149967#post2149967

Plugin B Code:

$template_hook['navtab_middle'] .= '<li'.$tabselected.'><a class="navtab" href="http://www.voicescount.com/forumdisplay.php?589-Businesses-Sellers-Listings-U.S.A.-Nationwide-Statewide-and-by-American-Cities">U.S.A. Listings</a>'.$tablinks.'</li>';

Plugin C Code:

$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'Cdn Listings')
{
$vbulletin->options['selectednavtab']='Cdn Listings_tab';
$tabselected = ' class="selected"';
$tablinks = '
<ul class="floatcontainer">
<li><a href="http://www.voicescount.com/forumdisplay.php?2176-Businesses-Sellers-Listings-Canada-Nationwide-Provincewide-amp-by-Canadian-Cities">Cdn Listings</a></li>
</ul>
';
}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="http://www.voicescount.com/forumdisplay.php?2176-Businesses-Sellers-Listings-Canada-Nationwide-Provincewide-amp-by-Canadian-Cities">Cdn Listings'.$tablinks.'</li>' ;

As you can see I'm trying.

Please review the above codes and I appreciate any insite.

Thanks Again

Lynne
02-21-2011, 09:55 PM
For Plugin A & B, you have not posted your unique condition at all, so I don't know where the problem is. I do know that if you are linking to a forumdisplay page that you won't be able to use THIS_SCRIPT because all of the forumdisplay pages have that defined the same:
define('THIS_SCRIPT', 'forumdisplay');

As for the last, Plugin C, again, you are linking to a forumdisplay page and saying the condition is if THIS_SCRIPT equals 'Cdn Listings' but I don't see how you could possible define that since THIS_SCRIPT is already defined on the forumdisplay page to be 'forumdisplay' as I showed above.

You are going to have to use something like the forumid in the condition. Like:
if ($GLOBALS['forumid'] == 2176)
{
$vbulletin->options['selectednavtab']='whatever';
....

Truth66
02-21-2011, 11:51 PM
Thanks Lynne,

Your solution to Plugin C works:

I changed:
if (THIS_SCRIPT == 'Cdn Listings')

to:

if ($GLOBALS['forumid'] == 2176)

The single Tab now works the way it's supposed to.

Based on your solution, how would your original code at the start of this thread be changed so that I could do the following:

The main tab says Listings

A person clicks onto Listings and a drop menu appears containing three or more sub tabs listed. Each of these sub tabs is linked to a different forum id.

Thanks Again

Lynne
02-22-2011, 01:42 AM
You would need to write some condition that is unique to whatever "Listings" is. I don't know anything about that page since it isn't a default vb page (or is it and you are just calling it something else?), so I don't know what the condition would be. If it's a custom page, then define THIS_SCRIPT at the top of the php page, like it is defined on other vB pages, and then you can use that in the condition.

Saviour
02-22-2011, 11:37 PM
Lynne,

Please be gentle with me on this...I've looked over your instructions...and I'm sitting here scratching my head.

I have a mod installed called Chatbox Evo. There is no option in this mod to add a link to the navbar, or to the community link menu.

I want to add a new tab on the navbar that opens the chatbox in full-page mode. I want to name this tab "Chat"...and it will be viewable by all who visit the site.

The link to call the full-size chatbox is as follows:
http://www.glitchpcforums.com/forum/mgc_cb_evo.php?do=view_chatbox

Now...can you give me step by step as to what I need to do? Thanks, in advance.

Lynne
02-23-2011, 12:18 AM
Not really. I don't know anything about the code for that mod. You may want to ask the developer if there is a THIS_SCRIPT set on that page that you can use in the condition. Then you could do something like:
if (THIS_SCRIPT == 'whatever_for_chat_mod' AND $_GET['do'] == 'view_chatbox')
So, something like that may work.

Saviour
02-23-2011, 02:58 PM
Not really. I don't know anything about the code for that mod. You may want to ask the developer if there is a THIS_SCRIPT set on that page that you can use in the condition. Then you could do something like:
if (THIS_SCRIPT == 'whatever_for_chat_mod' AND $_GET['do'] == 'view_chatbox')
So, something like that may work.

Lynne...

Thank you for the reply...

Yes, there is a THIS_SCRIPT set on the page:
define('THIS_SCRIPT', 'mgc_cb_evo');

So...what I'd like to do is setup a tab (labeled "Chat"), with no sub-menu links...so that when a user clicks the "Chat" tab, they are directed to the chat, itself.

Can you provide me with the code, or the modifications from your code...in order for me to complete this? I don't want to remove any lines of code from what you have given us...and leave myself hanging. I do understand coding...a little, but don't want to leave myself in a bind.

Thanks, in advance...

davepkr
02-23-2011, 04:25 PM
This is PERFECT for creating only a TAB, this is what I was looking for.

Do you have to create your own vBulletin page to use this? I created a section and am trying to use this tutorial to go to that section, yet I can't get the navbar to highlight. Here is the code as I have it now (I removed the submenu link code):

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

</ul> ';
}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="/forums/content/116-podcast">Podcast</a>'.$tablinks.'</li>' ;

Saviour
02-23-2011, 05:32 PM
Update...

Got 'er done! Thanks for the help...much appreciated.

Bellinis
03-02-2011, 11:04 AM
Update...

Got 'er done! Thanks for the help...much appreciated.

Tell me, how did you do it? I'd like to do the same :)

farrellzach
03-06-2011, 10:52 PM
Hi Lynne, I've read through a few of the posts here regarding having the forum tab highlighted along with the new tab. I added the tab fine, I'm using a UserCP tab, but the forum tab is highlighted when I click it.

Here's my plugin code if (THIS_SCRIPT == 'UserCP') // also defined('UserCP') possible
{
//set selected tab
$vbulletin->options['selectednavtab'] = 'UserCP';
}
// add the "subtemplate" to the navbartemplate
$template_hook['navtab_end'] .= vB_Template::create('UserCP Nav Bar')->render();

Lynne
03-06-2011, 11:18 PM
There is not default vbulletin script named "UserCP", so is this on a custom page? And, you cannot have a template called "UserCP Nav Bar" - you may not have spaces in a template name.

I really don't get what you are doing with your plugin code at all and I don't see the tab code in there either.

Guest210212002
04-10-2011, 09:12 PM
This is working just fine for me, and (as usual!) thank you, Lynne. :)

One quick question, here's my code - I'm just adding a link to vaispy. Everything works as it should, and I just removed the default dropdown menus from your code.


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

}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="(my test tld)forum/vaispy.php">ForumSpy</a>'.$tablinks.'</li>' ;

Is there a quick way to get the default set of tablinks (dropdowns) that are on forumhome/etc on a custom page? Right now my tab/link works perfectly, but I have no submenus. I'd like to add the usual things like User CP, Community and such back to the sublinks.

Thanks!

Lynne
04-10-2011, 09:20 PM
You would need to copy the submenu code from the navbar to add it to your tab. I think someone asked about this before recently, and they were pointed to ragtek's article about adding a navtab since he used a template and it was easier to copy/paste the code using his template method. So, you may want to check out his similar article.

Rebecca217
04-17-2011, 01:19 AM
This tutorial was very helpful. Thank you!

K4GAP
04-28-2011, 04:43 AM
As always, great article Lynne!

Thank you

TWood
05-03-2011, 09:08 PM
Can this method be used to add a tab to the navbar that opens a new browser window to an external website? I don't need any submenus, just a link to another site in its own window.

Lynne
05-03-2011, 10:15 PM
Yes. You just need the last line though:

$template_hook['navtab_end'] .= '<li><a class="navtab" href="link.php" target="_blank">Link Name</a></li>' ;

TWood
05-03-2011, 10:52 PM
Nice! Thanks!

The target="_blank" doesn't work to open a new browser window, at least not at my site:

Shout Street (http://shoutstreet.com/forum.php) Click on 'Zip Code Maps'

Boofo
05-03-2011, 11:07 PM
Sorry, the board is unavailable at the moment while we are testing some functionality.

We will be back soon...

TWood
05-03-2011, 11:20 PM
Heh, but the navbar is still active for this, it works the same either way - board on or off.

Boofo
05-03-2011, 11:47 PM
Okay, I just tried that link on my site with a target="_blank" in it and it opened another tab fine for me in Opera.

wowautoauctions
05-04-2011, 12:55 AM
How can I make my new tab appear first in the list? Using 'navtab_start' makes it the second tab but not the first.

EDIT: Figured it out.. You add in navtab_start then change the execution order from 5 to 4.

Lynne
05-04-2011, 03:55 AM
How can I make my new tab appear first in the list? Using 'navtab_start' makes it the second tab but not the first.

Play with the Execution Order of the plugin.

cellarius
05-04-2011, 05:35 AM
Nice! Thanks!

The target="_blank" doesn't work to open a new browser window, at least not at my site:

Shout Street (http://shoutstreet.com/forum.php) Click on 'Zip Code Maps'
From the source code of your page:
<li><a class="navtab" href="http://www.usnaviguide.com/">Zip Codes Map</a></li>
The target="_blank" is not present.

wowautoauctions
05-04-2011, 05:35 AM
If you are trying to make a tab that links to an already established page such as "content.php?139-blog", I found a solution:

First modify your plugin to include the end piece of your url in this case "/content.php?139-blog". This will enable your tab to be highlighted.
if (THIS_SCRIPT == 'vbcms' && $_SERVER['REQUEST_URI'] == '/content.php?139-blog')

Next you want to make it so the new tab is the only selected so go to plugin manager and edit "Navbar: Insert CMS Navbar Entry".

Change this:
if (defined('CMS_SCRIPT') AND class_exists('vBCms_Navbar'))

To This (except fill in your page name):
if (defined('CMS_SCRIPT') AND class_exists('vBCms_Navbar') AND $_SERVER['REQUEST_URI'] != '/content.php?139-blog')

Viola!

cellarius
05-04-2011, 06:03 AM
Of course both will highlight - the THIS_SCRIPT constant condition is true for the normal CMS tab, too. You need to edit the CMS tab condition to not highlight.

TWood
05-05-2011, 11:26 PM
From the source code of your page:
<li><a class="navtab" href="http://www.usnaviguide.com/">Zip Codes Map</a></li>
The target="_blank" is not present.

Gah!! Hate it when that happens... :o

Thanks!

Boofo
05-05-2011, 11:33 PM
From the source code of your page:
<li><a class="navtab" href="http://www.usnaviguide.com/">Zip Codes Map</a></li>
The target="_blank" is not present.

I was too lazy to do a view source.

av8or1
05-30-2011, 12:44 AM
Thank you for this writeup Lynne, I used a modified version of it to add a "Home" tab to my forum.

Jerry

attroll
06-13-2011, 06:51 PM
First let me say, great mod.

I have gotten the tab to work but I would like to resolve one issue if I can.

When I click on the tab it brings me to my gallery and the proper tab gets highlighted and stays highlighted. But when I click on the link under the tab "New in last day" then it opens in the gallery again like it is suppose to but it defaults to the "What's New" tab.

I would like it to stay in the Gallery Tab that I created and stay highlighted. Is there a way to do this?

Here is my code and the sample navbar image.

$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'ppindex')
{
$vbulletin->options['selectednavtab']='unique_name';
$tabselected = ' class="selected"';
$tablinks = ' <ul class="floatcontainer">
<li><a href="../gallery/search.php?when=1&whenterm=d&cat=all">New in last day</a></li>
<li><a href="../gallery/search.php?when=1&whenterm=w&cat=all">New in last 7 days</a></li>
<li><a href="../gallery/search.php?when=2&whenterm=w&cat=all">New in last 14 days</a></li>
</ul> ';

}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="../gallery">Test Tab</a>'.$tablinks.'</li>' ;

Lynne
06-13-2011, 07:38 PM
New in Last Day is a search? So, the condition for highlighting the search page are being met. You will need to rewrite the condition to highlight the search page to say "but not when doing New in Last Day" and then rewrite the gallery one to include "when doing New in Last Day".

appsfinder
07-08-2011, 08:13 AM
Hi lynne how do i make the work for forum uses only eg not guests thanks


Here's a pretty simple method for creating a new tab in the navbar, along with a submenu to go along with it. All you need is a unique condition for when your tab will be shown. What you will be making is a plugin to create the Nav Link along with a submenu which Link 1, Link 2, Link 3, and Drop Down which then drops down and has SubLink 1, SubLink 2, and SubLink 3. This is shown below.

https://vborg.vbsupport.ru/attachment.php?attachmentid=106093&d=1258146126


This article is NOT to be used just to add another link to a submenu. It is for creating the Nav Link tab along with all the submenus. Again, if all you want is to add submenus to an existing tab, then this article is NOT for you!!!

This article is also for use by users who understand the basics of conditions and can write them. The navbar is not really an easy thing to play with if you don't know what you are doing - I think even Wayne said it had issues - so don't try this if you don't understand how to write a condition.

OK, with that out of the way....

Here's the basic template for making your new tab:

Create a plugin (Plugins & Products) > Add New Plugin:
hook location - process_templates_complete *
Title - New Tab for Navbar
Execution Order - 5
(* I used to have this listed as global_state_check but then noticed vb themselves use the process_templates_complete hook location, so I changed it.)


$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'yourpage')
{
$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> ';

}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="link.php">Nav Link</a>'.$tablinks.'</li>' ;
Things to take note of:

if (THIS_SCRIPT == 'yourpage')Your condition MUST be unique! If you use a condition that is also going to evaluate to true for another tab, then they will both be highlighted and the wrong submenu may show up underneath.

$vbulletin->options['selectednavtab']='unique_name';The 'seletednavtab' must also be a unique name. Again, if you have two tabs with the same 'selectednavtab' name, then both tabs will be highlighted.

$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="link.php">Nav Link</a>'.$tablinks.'</li>' ;You may use a different template_hook here - it just depends on where you want your tab to be - navtab_start and navtab_middle are also available.


ragtek also posted an article to do the same thing only using a template with the plugin - [HOW TO - vB4] Create a New Tab in the navbar (with template) (https://vborg.vbsupport.ru/showthread.php?t=228313)



Originally posted on vb.org 2009-10-27.

Other related articles of possible interest:
[HOW TO - vB4] Remove the vB Default Navtabs (https://vborg.vbsupport.ru/showthread.php?t=234220)
[HOW TO - vB4] Create your own vBulletin page (https://vborg.vbsupport.ru/showthread.php?t=228112)

Lynne
07-08-2011, 04:02 PM
Hi lynne how do i make the work for forum uses only eg not guests thanks
You would need to put a condition around it to only be created for a member. There is another article full of conditions that should help you out.

appsfinder
07-08-2011, 04:14 PM
You would need to put a condition around it to only be created for a member. There is another article full of conditions that should help you out.

thanks for info do you have link please

Lynne
07-08-2011, 07:35 PM
It's right near the top of this artilces forum - vB4 Template Conditionals List (https://vborg.vbsupport.ru/showthread.php?t=231525)

MyLibary
07-13-2011, 03:38 PM
Lynn So all i should do is just create plugin and put the code

$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'yourpage')
{
$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> ';

}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="link.php">Nav Link</a>'.$tablinks.'</li>' ;

Then, it will add the link automaticly to the navbar, or i should also edit the navbar template?

Thanks alot!

Lynne
07-13-2011, 03:47 PM
Then, it will add the link automaticly to the navbar, or i should also edit the navbar template?

Thanks alot!
You only need to create the plugin, not edit the template.

MyLibary
07-13-2011, 04:06 PM
Lyyne,
Im happy that it added to the navbar, but that keep "Forum" tab selected and show the "Forum" sublinks.

$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'albumtab')
{
$vbulletin->options['selectednavtab']='album_tab';
$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> ';

}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="/album.php">Gallery</a>'.$tablinks.'</li>' ;

What else should i change?

Lynne
07-13-2011, 04:09 PM
Is there a page that has THIS_SCRIPT defined as "albumtab"? If not, then the subnav will never show and the tab won't be highlighted. Your condition needs to be a valid, unique condition.

MyLibary
07-13-2011, 04:13 PM
OK i got it, THIS_SCRIPT apear in the php file.

But what if i want to redirect to page such as www.site.com/content.php?r=5-News ?

I cant do that?

Thanks alot!

Lynne
07-13-2011, 09:53 PM
Sure you can redirect to that - why can't you? If you want to have the tab highlighted at that time, then you will need to write a unique condition for it (when r == 5-News) and most likely modify the condition for when the CMS Home tab shows up to NOT be highlighted if r == 5-News.

mhudson
07-17-2011, 03:56 PM
Im having problems with getting tabs to show for only one usergroup

Im guessign its a case of using an IF statement but i cant work out where it needs to go or what needs to be in it

my site (http://mhudson324.com/portal/forum.php) the final link to the team portal i want to be visable to only one user group (game crew (id 9)) but i cant work out how to do it :P im still trying to get my head around the new coding and ways of doing things

the site is mainly just a test at the moment however once i have it working i will be putting the ideas in to use on the main forum (http://forum.travian.pk)

Thanks for the great guide Lynne its been really helpfull


PS. Sorry if someone has already asked this

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..


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
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..


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
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
Where does it belong..?

Thank you for the quick response.
Your code should look like:
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>' ;
}

Spyike
07-18-2011, 10:07 PM
Your code should look like:


Greatly appreciate it, thanks.

HMBeaty
07-18-2011, 10:07 PM
Greatly appreciate it, thanks.
No problem :)

Lynne
07-18-2011, 10:09 PM
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
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
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
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
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:

$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:
if (THIS_SCRIPT == 'chat')and
$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!



$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
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
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
Quick question Lynn,

my site: www.droid-tech.com (http://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
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
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 1320080013 at 1320080013 ---------------

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
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
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
Just in case, if someone only wants to add a tab, here is the modified 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:
if (THIS_SCRIPT == 'chat')and
$vbulletin->options['selectednavtab']='chat';With some unique name.

Here is what I have:

$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.

$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
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 1320588568 at 1320588568 ---------------

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
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:
$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).

JErix
11-22-2011, 07:17 PM
Thanks for the tut. I'm a complete newb and it took a little reading, but, I got it figured out. :)

kfyonur
11-30-2011, 10:17 AM
thank you lynee very nice.

kfyonur
12-04-2011, 10:39 AM
is it correct ?

$tabselected = '';
$tablinks = '';
if ($GLOBALS['forumid'] == 66)
{
$vbulletin->options['selectednavtab']='audiservis';
$tabselected = ' class="selected"';
}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="http://www.audiclubtr.com/f66/">Audi Servis</a>'.$tablinks.'</li>' ;

Lynne
12-05-2011, 04:06 AM
It looks correct. Did you try it?

GE-Tom
12-05-2011, 09:37 AM
It is correct. Works fine with my urls.

@ Lynne

mutch thanks for this great tutorial. helps me a lot. now i only must finde out how i add a dropdown for my main menu tab.

gm139
12-11-2011, 07:56 PM
I am using vbulletin suite 418. I would like to add 3 tabs on the navbar, so I have copied your code 3 times in the plugin.
Each tab points to to the page content.php, followed by different parameters for each page. Links work, so when I click on a tab the correct page is shown, but the tab is not highligheted. Any suggestion?

Lynne
12-11-2011, 08:22 PM
I am using vbulletin suite 418. I would like to add 3 tabs on the navbar, so I have copied your code 3 times in the plugin.
Each tab points to to the page content.php, followed by different parameters for each page. Links work, so when I click on a tab the correct page is shown, but the tab is not highligheted. Any suggestion?
You need to create a unique condition for each page. Replace this:
if (THIS_SCRIPT == 'yourpage')With a unique condition for the page. It does not have to be a condition based on the variable THIS_SCRIPT. It may be any unique condition.

gm139
12-11-2011, 08:51 PM
You need to create a unique condition for each page. Replace this:
if (THIS_SCRIPT == 'yourpage')With a unique condition for the page. It does not have to be a condition based on the variable THIS_SCRIPT. It may be any unique condition.

As suggested at post 423 I have modified the script in this way but it does not work yet.

$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'vbcms' && $_SERVER['REQUEST_URI'] == '/content.php?3-prossima-trasferta')
{
$vbulletin->options['selectednavtab']='prossima-trasferta';
$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> ';

}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="content.php?3-prossima-trasferta">Prossima trasferta</a>'.$tablinks.'</li>' ;

Hippy
12-11-2011, 09:33 PM
if (THIS_SCRIPT == 'vbcms' && $_SERVER['REQUEST_URI'] == '/content.php?3-prossima-trasferta')
the line above should only read
if (THIS_SCRIPT == 'vbcms')

I think..

gm139
12-11-2011, 10:22 PM
if (THIS_SCRIPT == 'vbcms' && $_SERVER['REQUEST_URI'] == '/content.php?3-prossima-trasferta')
the line above should only read
if (THIS_SCRIPT == 'vbcms')

I think..
no, because I call the content.php from different tabs.

Lynne
12-11-2011, 10:39 PM
Have you tried spitting out $_SERVER['REQUEST_URI'] on the page to verify you have it set correctly for the page? It may be different than in that example based on the type of Friendly URLs you are using.

And did you make the change to the plugin also?

gm139
12-11-2011, 11:00 PM
Have you tried spitting out $_SERVER['REQUEST_URI'] on the page to verify you have it set correctly for the page? It may be different than in that example based on the type of Friendly URLs you are using.

And did you make the change to the plugin also?
No. I do. I'm using a eloquent red skin. I want to try with the deafault one too. No I didn't modifi the plugin.

--------------- Added 1323682221 at 1323682221 ---------------

No. I do. I'm using a eloquent red skin. I want to try with the deafault one too. No I didn't modifi the plugin.

tried. REQUEST_URI is empty. Any idea?

--------------- Added 1323688580 at 1323688580 ---------------

I have finally found a way that works, with this condition:

if ($_SERVER['HTTP_REFERER'] == 'http://www.piacenzacalcio.net/vb/content.php?3-prossima-trasferta')

The condition is verified, but still the tab is not highlighted and submenus do not appear. here is the plugin:

$tabselected = '';
$tablinks = '';

if ($_SERVER['HTTP_REFERER'] == 'http://www.piacenzacalcio.net/vb/content.php?3-prossima-trasferta')
{ $vbulletin->options['selectednavtab']='prossimatrasferta';
$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> ';

*/echo $tablinks;
die();*/

}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="content.php?3-prossima-trasferta">Prossima trasferta</a>'.$tablinks.'</li>' ;

I have verified that $tablinks is not empty, through the echo you can see.

intruder
12-18-2011, 03:01 PM
UP, it would be great to have something like

$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'test' OR in_array($GLOBALS['forumid'], array(58, 59, 60, 56)))

for the cms also.

THIS_SCRIPT == 'test' -> vbcmspage
forum.id -> section.id

Any ideeas?

malinghi
01-21-2012, 11:15 PM
Forgive me if someone asked this, but I didn't see anything like this in the comments. I want a tab on the navbar to randomly link to one of a couple dozen websites. I found code to do this with javascript or with php, and the code works fine, but I can't figure out how to incorporate it into the code for the tab.

Here's one of the codes I found for making a random link:

$links = array("link 1", "link 2", "link 3");
$max = sizeof($links);
$rand = rand(0, $max);
echo ("<a href = \"$links[$rand]\">Click Here for a Random Link</a>");

I've tried to just insert something after href=, like $links[$rand], or echo($links[$rand]), or print($links[$rand]), into the last line of the code for the plugin but then the navbar link just takes me to www.mywebsite.com/$links[$rand].
<a class="navtab" href=$links[$rand]>Nav Link</a>'.$tablinks.'</li>' ;


I've considered using the random number generator to send it to a bunch of if statements with each one having the last line from your code but with a different url, but I was worried that having dozens of if statements get evaluated every time someone loads a page on my site might slow it down or be bad for it or something.

Lynne
01-22-2012, 12:08 AM
It would need to be something like this:
<a class="navtab" href="'.$links[$rand].'" >Nav Link</a>'.$tablinks.'</li> ;

malinghi
01-22-2012, 09:36 AM
I'm not sure why, but it didn't work. This is the full version of the last line, just to make sure I inserted the code correctly:

$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href=$links[$rand]>Nav Link</a>'.$tablinks.'</li> ;


And the error I get is:


Warning: Unexpected character in input: ''' (ASCII=39) state=1 in /home/mernet/public_html/index/includes/class_bootstrap.php(555) : eval()'d code on line 62

Parse error: syntax error, unexpected '<' in /home/mernet/public_html/index/includes/class_bootstrap.php(555) : eval()'d code on line 62

TheSupportForum
01-22-2012, 11:54 AM
I'm not sure why, but it didn't work. This is the full version of the last line, just to make sure I inserted the code correctly:

$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href=$links[$rand]>Nav Link</a>'.$tablinks.'</li> ;
And the error I get is:


Warning: Unexpected character in input: ''' (ASCII=39) state=1 in /home/mernet/public_html/index/includes/class_bootstrap.php(555) : eval()'d code on line 62

Parse error: syntax error, unexpected '<' in /home/mernet/public_html/index/includes/class_bootstrap.php(555) : eval()'d code on line 62

asuming you are using a plugin for this try this



$template_hook['navtab_end'] .= ('<li'.$tabselected.'><a class="navtab" href=$links[$rand]>Nav Link</a>'.$tablinks.</li>');

malinghi
01-22-2012, 02:28 PM
Simonhind, I just tried the code you suggested. It didn't give the "Warning: Unexpected character in input" error, but it did still give the parse error about the '<' bracket. Here's the full error message.

Parse error: syntax error, unexpected '<' in /home/mernet/public_html/index/includes/class_bootstrap.php(555) : eval()'d code on line 62

leftanalog
01-24-2012, 02:25 AM
Im not sure why, but I cannot get ANY tabs to show up to the right of the what's new tab. Ive tried Mods (from vb.org) as well as this. Ive tried this code stock. I cannot get ANY tab to show up to the right of my "What's New" tab.

Currently I only have FORUMS, and WHATS NEW.

What could be the issue? Any help please?

TheSupportForum
01-24-2012, 09:17 AM
does anyone know the css to increase the height of the tabs

------
edit : found the styvar, now thats looking better

--------------- Added 1327405000 at 1327405000 ---------------

Simonhind, I just tried the code you suggested. It didn't give the "Warning: Unexpected character in input" error, but it did still give the parse error about the '<' bracket. Here's the full error message.

Parse error: syntax error, unexpected '<' in /home/mernet/public_html/index/includes/class_bootstrap.php(555) : eval()'d code on line 62

can you provide the full plugin code, either here or via PM and i'll take a proper look