vb.org Archive

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

JointRolla420 01-07-2010 08:42 AM

i only needed the links in the main navbar so for me this worked...

$tabselected = '';
$tablinks = '';
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="http://xxxxxxxxxx/payments.php">Buy VIP!</a>'.$tablinks.'</li>' ;

$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="http://xxxxxxxxxx/" target="_new">xxxxxxxx</a>'.$tablinks.'</li>' ;

but im still trying to figure out how to put a gap after the nav buttons end and then another one near the other side, connected to the search bar

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

yea i tryed but i still cant figure out how to make one link stay at the far right instead of beside each other, a space and it shows at the very end of the bar...

i tried <ul style='float:right'> but even if that worked its probably not the best coding so some help would be appreciated

OcR Envy 01-07-2010 09:07 AM

Quote:

Originally Posted by MikeWarner (Post 1949387)
Yeah - the items listed within the main page body do refer back to the original php file. I'm trying to think of a way around this. I'll post when I figure it out.


About the only thing I've come up with is to remove all class="selected" for vbcms then write a plugin to specify what to select based on section id. Has to be an easier way though :(

psypher 01-12-2010 06:57 PM

1 Attachment(s)
Excellent mod, works great. Has anyone figured out an easy way to use templates to pupulate the pages upon sub menu link clicks or does it have to be external or new page links?

I tried the 48-What-is-RideHub suggestions but my home tab always stays selected and it was very buggy for me.

The site I am working to complete is http://deathcompanygaming.net/epeenery/

On my roster page I would like to use the dropdown menu to populate our roster for each game. I haven't been able to get jquery to be very stable and play nice with vB4 yet so is there an onclick event that will load templates into a particular div tag that can be used in the link?

PukkaBen 01-14-2010 11:56 AM

Hey Lynne!! I have used this code, but I can't seem to get it to work, or part of it to work. I have modified the code and it is shown below.

PHP Code:

$tabselected '';
$tablinks '';
if (
THIS_SCRIPT == 'status')
{
    
$vbulletin->options['selectednavtab']='radio_tab_001';
    
$tabselected ' class="selected"';
    
$tablinks '     <ul class="floatcontainer">
                        <li><a href="#">About</a></li>
                        <li><a href="schedule.php">Schedule</a></li>
                        <li><a href="status.php">Status</a></li>
                      </ul> '
;

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

I have made two pages, schedule and status. The about page has not been made yet but it in the process of being made using your HOW-TO (thanks for that one!!). When I click the "Radio" section on the biggest bar, it selects itself and highlights as it should, but then when I go to the schedule.php link it goes back to the Forum tab.

You can see it in action if you wish at http://forum.pukkaradio.net

Cheers for any help that may come of this!!

Lynne 01-14-2010 02:05 PM

Quote:

Originally Posted by PukkaBen (Post 1955393)
I have made two pages, schedule and status. The about page has not been made yet but it in the process of being made using your HOW-TO (thanks for that one!!). When I click the "Radio" section on the biggest bar, it selects itself and highlights as it should, but then when I go to the schedule.php link it goes back to the Forum tab.

You can see it in action if you wish at http://forum.pukkaradio.net

Cheers for any help that may come of this!!

You need to make your condition cover *all* the pages you wish it to stay highlighted for. If your schedule.php page has THIS_SCRIPT defined as 'schedule', then change the condition to this:
PHP Code:

if (in_array(THIS_SCRIPT, array('status''schedule'))) 


PukkaBen 01-14-2010 05:38 PM

Awesome!! Thanks ever so much Lynne!!

flegul 01-15-2010 02:04 PM

Hi All.
Browsed through this entire thread and I am still no wiser to my predicament. what I would like to do is simply add an extra standard Navbar Tab which will redirect the user to my other external website.

Example
"www.myadvertising-program.com"

https://vborg.vbsupport.ru/

Thanks.

psypher 01-15-2010 06:35 PM

To keep the tab highlighted for my sublinks I just added the or statement to the beginning and used multiple php files.

if (THIS_SCRIPT == 'recruitment.php' || THIS_SCRIPT == 'recruitment_status.php' || THIS_SCRIPT == 'epeen_application.php')

InfoNirvana 01-17-2010 04:08 PM

Quote:

Originally Posted by flegul (Post 1956500)
Hi All.
Browsed through this entire thread and I am still no wiser to my predicament. what I would like to do is simply add an extra standard Navbar Tab which will redirect the user to my other external website.

Example
"www.myadvertising-program.com"

http://i744.photobucket.com/albums/x...ad/Capture.jpg

Thanks.

If that is all you want to do, there is a MOD for that.

vBH-Add new tabs
https://vborg.vbsupport.ru/showthread.php?t=228507

Mythotical 01-19-2010 02:23 AM

Lynne,

How would I construct the if condition for a link like so:
Code:

misc.php?do=rules

Lynne 01-19-2010 02:41 AM

Quote:

Originally Posted by Steve M (Post 1959836)
Lynne,

How would I construct the if condition for a link like so:
Code:

misc.php?do=rules

Perhaps something like:
PHP Code:

if (THIS_SCRIPT == 'misc' AND $_REQUEST['do'] == 'rules'


Mythotical 01-19-2010 02:46 AM

Quote:

Originally Posted by Lynne (Post 1959857)
Perhaps something like:
PHP Code:

if (THIS_SCRIPT == 'misc' AND $_REQUEST['do'] == 'rules'


Tried that before and didn't work, did it again then realized I needed to change my template.

Thanks

Kinneas 01-19-2010 08:22 AM

Lynne,

Is there any way to add an extra tab using this method, while retaining the same tablinks as are used on the Forum tab?

For my example, I'm trying to add a "Home" tab for vBa CMPS, but want to keep all the links you find on the Forum one.

Lynne 01-19-2010 04:14 PM

You may just copy all the links for the Forum tab.

foesracing 01-19-2010 07:08 PM

I'm trying to create a forum for Traveling. I've downloaded and installed vBh that allows me to add extra tabs. These tabs only link to another site.

I want to create a Nav menu like this "Forum | Travel | Hotels | Car Rental"

When the user clicks on a tab, it will open the tab in the same window but it would be about the topic the user click on. I've seen on other sites that this is possible. Just wondering how it's done. Please provide some details. I'm on vB 4.0.1, just in case you need to know the version. Thanks.

Lynne 01-19-2010 07:11 PM

I can't tell you how to use the other mod - I have no idea how it works. This article will tell you how to create a navtab, such as Travel, and you link it to your forumdisplay.php page for that forum. If you want the tab highlighted at that point, then do an if condition based on the $forumid.

saajjj 01-19-2010 08:11 PM

1 Attachment(s)
Hi Lynne,
This might either be slightly off topic or may perhaps help others if added to your initial post. My search on changing tab order didn't return any useful results. However if whatever I've written is a commonly known solution, please disregard and delete the post :)

All,
It seems many people have asked about reordering tabs in the nav bar.

As mentioned in many places there are three template hooks which allow you to place your new tab:
- navtab_start
- navtab_middle
- navtab_end

Lynne has used the navtab_end hook which is in the last line of the PHP Code:
Code:

$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="link.php">Nav Link</a>'.$tablinks.'</li>' ;
I'm going to assume the default tabs as:
Forum | Blogs | What's New

If we use the Lynnes way of creating a tab as explained here, but use the navtab_middle hook like:
Code:

$template_hook['navtab_middle'] .= '<li'.$tabselected.'><a class="navtab" href="link.php">Nav Link</a>'.$tablinks.'</li>' ;
then the new tab comes between Forum and Blogs. But we want to add the tab after Blogs. To move over the new tab after Blogs just change the execution order from 5 to 6. So by using different execution orders in different plugins you can place your tabs in any order you want within the same template hook. You could of course generate all tabs from one plugin and use code execution order to place the tabs.

This is the only reliable solution I have found and am using it on my own forum (img attached). I'm open to other methods as well.

Cheers

foesracing 01-19-2010 08:44 PM

Lynne,

Can you post the link.php code you mention in the very first post of the thread.

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

I would like to see how link.php is written.

Thanks.

Lynne 01-19-2010 09:34 PM

Quote:

Originally Posted by foesracing (Post 1960588)
Lynne,

Can you post the link.php code you mention in the very first post of the thread.

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

I would like to see how link.php is written.

Thanks.

link.php is a fictitious page. It is whatever page you want to link to.

foesracing 01-19-2010 11:45 PM

Quote:

Originally Posted by Lynne (Post 1960619)
link.php is a fictitious page. It is whatever page you want to link to.


I understand that. I just want to see how another page is written, which variable is need to recreate the same page as forum.php but displaying a different information. I know how to code php but don't know the structure of how vbulletin assembles its code.

worried 01-20-2010 01:25 PM

HTML Code:

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

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

What am I doing wrong here? All I want is a button (no sub menu). Everything works fine except the Forum button is selected instead when clicking the Albums button.

Lynne 01-20-2010 01:32 PM

Quote:

Originally Posted by foesracing (Post 1960719)
I understand that. I just want to see how another page is written, which variable is need to recreate the same page as forum.php but displaying a different information. I know how to code php but don't know the structure of how vbulletin assembles its code.

This may help - [HOW TO - vB4] Create a own vBulletin page

Quote:

Originally Posted by worried (Post 1961186)
HTML Code:

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

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

What am I doing wrong here? All I want is a button (no sub menu). Everything works fine except the Forum button is selected instead when clicking the Albums button.

If you look at the top of your album.php page, you will see THIS_SCRIPT defined here:
PHP Code:

define('THIS_SCRIPT''album'); 

You put 'album.php' instead of the correct 'album' in the conditional. Change it.

worried 01-20-2010 02:25 PM

Thank You! :)

Wormy! 01-21-2010 09:51 PM

I've just read this thread - and I may have missed something... in which case I apologise up front! Having said that... I'm also somewhat (ok, a lot) confused...

I would like to add a new tab called HOME and I would like to have it display on ALL pages throughout my site.

Could someone please help me with this? Or point me in the right direction pls?

Thanks in advance...

Lynne 01-21-2010 09:55 PM

If you create a new navtab via a plugin (like in this mod), it will show on all your pages.

Wormy! 01-21-2010 09:56 PM

Hi Lynne

Thanks... you mean as in the very first post? I hope you can understand I was a little confused by the time I had read all of the posts...

Cheers
Wormy

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

Wow... I followed the first post and bingo... all done in a matter of about 2 minutes.

Next time I'll give the opening post/tutorial a go before I read ALL of the posts in the thread :)

Thanks SO much Lynne!!

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

One QQ... is it possible to have the hiughlight line above the button appear (like the default buttons in VB)?

Lynne 01-21-2010 11:13 PM

Quote:

Originally Posted by Wormy! (Post 1962827)
One QQ... is it possible to have the hiughlight line above the button appear (like the default buttons in VB)?

You make the tab be active, or highlighted, by setting the condition correctly for the submenu.

Wormy! 01-21-2010 11:31 PM

Quote:

Originally Posted by Lynne (Post 1962899)
You make the tab be active, or highlighted, by setting the condition correctly for the submenu.

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 [DATE]1264124054[/DATE] at [TIME]1264124054[/TIME] ---------------

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

Lynne 01-22-2010 01:49 AM

In my plugin is this line:
PHP Code:

if (THIS_SCRIPT == 'yourpage'

I later say that this must be a unique condition for your tab page to be highlighted. What do you have for that condition?

princeedward 01-22-2010 06:34 PM

Thanks Lynne...manage to create also this great tutorial from you....just can't figure it out how to hide this DropDown Menu to Guest...tried the one you mention above but no luck...

can you please assist me here...


PHP Code:

<li class="popupmenu">
                                <
a href="javascript://" class="popupctrl">Drop Down Menu</a>
                                <
ul class="popupbody popuphover"

<
li><a href="arcade.php?&act=Arcade&module=settings">Settings</a></li>

<
li><a href="arcade.php?&act=Arcade&module=favorites">Favorites</a></li>

<
li><a href="arcade.php?&act=Arcade&module=report">Rankings</a></li
                                </
ul>
                            </
li>
                        
                </
ul'; 

thanks and best regards...

;):up:

Lynne 01-22-2010 07:11 PM

Quote:

Originally Posted by princeedward (Post 1963676)
Thanks Lynne...manage to create also this great tutorial from you....just can't figure it out how to hide this DropDown Menu to Guest...tried the one you mention above but no luck...

can you please assist me here...

Please post your whole plugin, not just part of it.

princeedward 01-22-2010 07:20 PM

PHP Code:

<li><a href="arcade.php?&act=Arcade&do=createtourney">Create New Tournament</a></li>


<
li class="popupmenu">
               <
a href="javascript://" class="popupctrl">MiscMenu</a>
               <
ul class="popupbody popuphover"


<
li><a href="arcade.php?&act=Arcade&module=settings">Settings</a></li>

<
li><a href="arcade.php?&act=Arcade&module=favorites">Favorites</a></li>

<
li><a href="arcade.php?&act=Arcade&module=report">Rankings</a></li

                                </
ul>     

<
li class="popupmenu">
               <
a href="javascript://" class="popupctrl">Games Menu</a>
               <
ul class="popupbody popuphover"


just like i said just want to hide the Misc. Menu to Unregistered Groups... or else everthing....

Lynne 01-22-2010 10:16 PM

PHP Code:

...
<
li><a href="arcade.php?&act=Arcade&do=createtourney">Create New Tournament</a></li>';

if (is_member_of($vbulletin->userinfo, x))
{
    $tablinks .= '
<li class="popupmenu">
               <
a href="javascript://" class="popupctrl">MiscMenu</a>
               <
ul class="popupbody popuphover"
<
li><a href="arcade.php?&act=Arcade&module=settings">Settings</a></li>
<
li><a href="arcade.php?&act=Arcade&module=favorites">Favorites</a></li>
<
li><a href="arcade.php?&act=Arcade&module=report">Rankings</a></li
                                </
ul></li>';
}     

    $tablinks .= '
<li class="popupmenu">
               <
a href="javascript://" class="popupctrl">Games Menu</a>
               <
ul class="popupbody popuphover">
... 

Change the x in the condition to the usergroupid you want to show it to. Or use this:
PHP Code:

if (!is_member_of($vbulletin->userinfox)) 

and change the x to the usergroupid you do NOT want to show it to.

princeedward 01-23-2010 03:35 AM

fantastic Lynne....thanks once again for your help... ;):up:

Naxon 01-28-2010 12:19 PM

how do I put the tab before the "What's New?" tab and not after it?

Storyteller69 01-28-2010 12:43 PM

Read the article:
Quote:

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.

Naxon 01-28-2010 12:47 PM

I don't have these hook locations...

Lynne 01-28-2010 02:47 PM

Quote:

Originally Posted by Naxon (Post 1968905)
I don't have these hook locations...

If you don't have them, then you removed them and you will have to add them back. (We are talking about the *tempate_hook* locations here, not the plugin hook location.)

Naxon 01-28-2010 04:17 PM

oops, my bad...

but 'navtab_middle' puts it before the blogs tab, how do I put it between the blogs tab and the what's new tab?

Lynne 01-28-2010 04:40 PM

Change the Execution Order of the plugin.


All times are GMT. The time now is 02:39 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03999 seconds
  • Memory Usage 1,892KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (2)bbcode_html_printable
  • (10)bbcode_php_printable
  • (14)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete