vb.org Archive

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

Lynne 11-18-2009 12:38 AM

I added a bit more to the first post including the part about going to the Plugin Manager. However, this article really isn't for the total novice. You need to understand what a condition is and be able to write one.

Lionel 11-18-2009 06:16 AM

I looked but did not find the answer. How do you add a phrase in this code for Sublink 1?

<li><a href="sublink1.php">SubLink 1</a></li>

I tried ' . $vbphrase['my_phrase'] .'
I tried {vb:rawphrase my_phrase}

never mind ... I needed to globalize it

EidolonAH 11-18-2009 06:42 AM

What ever level we understand coding Lynne should not matter, I accept my understanding of coding needs improvement, but that's not the point. We are trying to get our heads around vB4, which is no walk in the park and we look to people like yourself for help. You do a fantastic amount of good here and I personally truly appreciate that, but clear and straight forward guides help more than being told we lack understanding.

To cellarius, I apologise, I find myself enduring a great deal of keyboard warriors here and there and I mistook your post as yet another jibe from another coward hiding behind a keyboard. Didn't mean to be offensive and I am sorry for offending you.

cellarius 11-18-2009 07:42 AM

Neither did I want to mock you or anything, sorry for perhaps coming off like that - so, we're good here :)

Anyway, I really see where you are coming from, I learned a lot from tutorials like this very one. I understand what you mean, but it is always about finding a middle way in texts like this. There's some basics you need to build upon if you want to do some in-depth explaining, or the tutorials would get overly complex. There's other articles about the plugin system, and even a section in the manual. If one had to explain that every time again, the articles would be cluttered. Finding this middle way is not always easy, tho, and you won't be able to need everyones needs :o

Dave-ahfb 11-18-2009 01:24 PM

How can we change the display order of the navbar. Meaning put new items(per this tutorial), so that they show between "blogs" and "whats new"

Lynne 11-18-2009 01:36 PM

Quote:

Originally Posted by Dave-ahfb (Post 1916579)
How can we change the display order of the navbar. Meaning put new items(per this tutorial), so that they show between "blogs" and "whats new"

There are currently three template_hooks available for adding the tabs (I listed them in the first post). If none of those are located where you want them, then you can just add one into the template where you want it. That will require editing the template though.

crazyace 11-18-2009 03:01 PM

Lynne,

Thanks for this awesome guide. So I'm trying to hide the tab from people not logged in. Also I only want some user groups to see it. This is what I have so far.

PHP Code:

global $template_hook;
$tabselected '';
$tablinks '';
if (
THIS_SCRIPT == 'Buy Now')
if (
is_member_of($vbulletin->userinfo567))
{
    
$vbulletin->options['selectednavtab']='Buying';
    
$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">Test Link 1</a></li>
                                        <li><a href="sublink2.php">Test Link 2</a></li>
                                        <li><a href="sublink3.php">Test Link 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="http://mysite.com/forum/showthread.php?1-testpost">Buy Now</a>'.$tablinks.'</li>' 

I tried just testing out the if statement first to see if I could only let some user groups see the tab. But that didn't work. Maybe I placed it in the wrong place?

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

Woot I just fixed it. I put the if statement above the global and it works. Doesn't matter about the member part now. Because if they are not part of the right group it won't even show up. :-)

So here is my answer:
PHP Code:

if (is_member_of($vbulletin->userinfo567))
global 
$template_hook;
$tabselected '';
$tablinks '';
if (
THIS_SCRIPT == 'Buy Now')
{
    
$vbulletin->options['selectednavtab']='Buying';
    
$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">Test Link 1</a></li>
                                        <li><a href="sublink2.php">Test Link 2</a></li>
                                        <li><a href="sublink3.php">Test Link 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="http://mysite.com/forum/showthread.php?1-testpost">Buy Now</a>'.$tablinks.'</li>' 


Lynne 11-18-2009 03:42 PM

You really should have { and } around the whole thing after your if is_member_of statement. Right now, you are basically just saying if is_member_of then make the $template_hook global, which is needed right now for this plugin to work. If they fix the issue of the $template_hook not being global, then suddenly your plugin isn't going to work because it will be made global elsewhere and therefore work.

crazyace 11-18-2009 06:13 PM

Ok so something like this?

PHP Code:

if (is_member_of($vbulletin->userinfo567))
{
global 
$template_hook;
$tabselected '';
$tablinks '';
if (
THIS_SCRIPT == 'Buy Now')
{
    
$vbulletin->options['selectednavtab']='Buying';
    
$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">Test Link 1</a></li>
                                        <li><a href="sublink2.php">Test Link 2</a></li>
                                        <li><a href="sublink3.php">Test Link 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="http://mysite.com/forum/showthread.php?1-testpost">Buy Now</a>'.$tablinks.'</li>' ;


Oh this is the Kallell account by the way :-) With your help we found out how to set up more than one account with access.

Lynne 11-18-2009 06:54 PM

Yes, that looks correct - you have the content of the whole plugin in the condition now.

Hello Kallell! Now I recognize you. :)

crazyace 11-18-2009 07:57 PM

Quote:

Originally Posted by Lynne (Post 1916773)
Yes, that looks correct - you have the content of the whole plugin in the condition now.

Hello Kallell! Now I recognize you. :)

:)

What about if I want to add two tabs? with one unblocked and the other one set to usergroups. Would it be like this:

PHP Code:

if (is_member_of($vbulletin->userinfo567))
global 
$template_hook;
$tabselected '';
$tablinks '';
if (
THIS_SCRIPT == 'Buy Now')
{
    
$vbulletin->options['selectednavtab']='Buying';
    
$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">Test Link 1</a></li>
                                        <li><a href="sublink2.php">Test Link 2</a></li>
                                        <li><a href="sublink3.php">Test Link 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="HTTP LINK or PHP file">Link Name</a>'.$tablinks.'</li>' ;
if (
is_member_of($vbulletin->userinfo567))
if (
THIS_SCRIPT == 'Download')
{
    
$vbulletin->options['selectednavtab']='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">Test Name</a>
                                <ul class="popupbody popuphover">
                                        <li><a href="sublink1.php">Test Link 1</a></li>
                                        <li><a href="sublink2.php">Test Link 2</a></li>
                                        <li><a href="sublink3.php">Test Link 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="HTTP LINK or PHP file">Link Name</a>'.$tablinks.'</li>' 


Lynne 11-18-2009 10:45 PM

Quote:

Originally Posted by crazyace (Post 1916824)
:)

What about if I want to add two tabs? with one unblocked and the other one set to usergroups. Would it be like this:

You would copy the plugin and put one after the other, like you did, however just don't wrap the unblocked one with the is_member_of condition AND call $tablinks and $tablselected something different in the second one - like $tablinks2 and $tabselected2.

ngkong 11-21-2009 09:26 AM

Quote:

Originally Posted by Lynne (Post 1916271)
I haven't tried many other conditions with this. If you want to do it for a Section, then you would also have to modify the existing navbar to not show the Home tab when you are on that section, otherwise it isn't unique. Right now, the Home tab shows whenever you are in the CMS area of the site. So, you'd have to change that condition to say "in the CMS but NOT in section xx" otherwise both tabs will be highlighted and only one of the submenus will be shown. I'm not sure what the exact condition would be since I'm not that familiar with all the variable names used with the new CMS ($sectionid == 2 ?).

how to find the variable name listing for the CMS? i'm looking anywhere and found nothing. i'm temporary disabling the highlight effect for Home and New Page navigation.

-edit-
i've just removed #navtabs li.selected a.navtab from vbulletin-chrome.css, the navigation structure doesn't make sense. when vbull combined with CMS, features such as calendar, FAQ, photo gallery, friends, group should be global and not under the forum section. they should have it's own link at the parent navigation bar. now i will just manually add navigation links from the template, hope vbull developer will fix this in the future.

j.steensen 11-22-2009 12:44 PM

Hello all! I am puzzled. I tried to adopt this with the following code to link to our store on our site.

PHP Code:

$tabselected '';
$tablinks '';
if (
THIS_SCRIPT == 'STORE')
{
    
$vbulletin->options['selectednavtab']='STORE_tab';
    
$tabselected ' class="selected"';
    
$tablinks '
<ul class="floatcontainer">
<li><a href="https://www.scsimulations.com/store/">Store</a></li>
</ul>
'
;

$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="https://www.scsimulations.com/store/">Store</a>'.$tablinks.'</li>' 

The above doesn't seem to do a thing.

Any help? (I'm not the best in PHP coding...so I appreciate a layman's explaination if possible.)

Lynne 11-22-2009 02:30 PM

Is "https://www.scsimulations.com/store/" this a page your wrote yourself? Does it have a line at the top that defines THIS_SCRIPT as STORE like this?
PHP Code:

define('THIS_SCRIPT''STORE'); 

When you say it doesn't seem to do anything, are you seeing a tab at all? Do you have the plugin active?

j.steensen 11-22-2009 02:56 PM

It sure is....and it wasn't activated...:eek:

Its always the simplest solution.

Appreciate it!

shadowedsoul 11-25-2009 07:46 PM

First off, great article it's really helped me in getting my test site going. Is there a way that anyone knows of to have a specific navtab show as selected if a certain article is showing. Basically I guess what i'd need to do is set what the script id is for a specific article. Any ideas?

Lynne 11-25-2009 08:11 PM

I am not familiar enough with the new cms to know the answer to that question. You would, however, have to actually do some modifying to some code somewhere since the condition is already set that if you are in the cms, then the Home tab is selected. So, you'd have to change that code to say "if in cms except this article, then the Home tab is selected".

Eric Anderson 11-26-2009 08:26 AM

Lynne, I have thehack working but would love to have a sub link on the sub link as you have tab saying Tech with a link saying Carburetors then you have Cleaning Carbs and Jetting. so you would have
Tech>Carbs>cleaning Carbs
and
Tech>Carbs>Jeting
Menu would look like
Carbs
Cleaning
Jetting
What would code be?

Lynne 11-26-2009 01:43 PM

Quote:

Originally Posted by Eric Anderson (Post 1921090)
Lynne, I have thehack working but would love to have a sub link on the sub link as you have tab saying Tech with a link saying Carburetors then you have Cleaning Carbs and Jetting. so you would have
Tech>Carbs>cleaning Carbs
and
Tech>Carbs>Jeting
Menu would look like
Carbs
Cleaning
Jetting
What would code be?

I'm not sure I follow you. The article covers how to get submenus. What is your exact plugin, and what is the result and what do you want changed (images would help).

Eric Anderson 11-26-2009 04:50 PM

1 Attachment(s)
Thanks for the quick reply... Great article. In the attachment you can see that I have it working. What I am looking to do is add a sub menu to the sub menu. I have the Tech Area tab then the sub menu that has Carbs trying to add a sub menu to carbs so it will have Cleaning link and Jetting link. So basically making when you click on carbs it does not take you to Carbs.php but opens a sub menu that would have links to jetting.php and Cleaning.php

Thanks
Eric
PHP Code:

$tabselected '';
$tablinks '';
if (
THIS_SCRIPT == 'Tech')
{
    
$vbulletin->options['selectednavtab']='Tech Area';
    
$tabselected ' class="selected"';
    
$tablinks '                <ul class="floatcontainer">
                        <li class="popupmenu">
                                <a href="javascript://" class="popupctrl">Vmax-4 750</a>
                                <ul class="popupbody popuphover">
                                        <li><a href="Carbs.php">Carbs</a></li>
                                        <li><a href="Clutch750.php">Clutching & Gearing</a></li>
                                        <li><a href="Pipes750.php">Pipes</a></li>
                                        <li><a href="Track.php">Track</a></li>
                                        <li><a href="Setup750.php">Setups</a></li>
                                </ul>
                            </li>
                            <li class="popupmenu">
                                <a href="javascript://" class="popupctrl">Vmax-4 800</a>
                                <ul class="popupbody popuphover">
                                        <li><a href="Carbs.php">Carbs</a></li>
                                        <li><a href="Clutch800.php">Clutching & Gearing</a></li>
                                        <li><a href="Pipes800.php">Pipes</a></li>
                                        <li><a href="Track.php">Track</a></li>
                                        <li><a href="Setup800.php">Setups</a></li>
                                </ul>
                            </li>
                        <li><a href="Specs.php">Stock Specs</a></li>
                </ul> '
;


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


Lynne 11-26-2009 04:53 PM

I don't know how to add a submenu to a submenu as I haven't tried to do that. You'll have to play with the css to do that.

Anseur 11-30-2009 08:33 PM

Is there any way to use vb if statements with this mod?

I tried wrapping certain links under the custom tab in the

Code:

<vb:if condition="$show['modcplink']">
*stuff here*
</vb:if>

(I only wish admins/mods to be able to see a certain link)

but it completely breaks this plugin, you get a
Quote:

Parse error: syntax error, unexpected T_STRING in /home/anseur/public_html/vb4test/includes/class_bootstrap.php(386) : eval()'d code on line 23
message from vb at the top of the custom page.

Does perhaps some other function have to be called in either this or the .php page in question? (I'm using the custom php page Lynne posted an article on in conjunction with this plugin)

the same vb if statement works if I put it elsewhere within a template that apears on the page, but I would like the link in question to be in the navbar and not in the body.

Lynne 11-30-2009 08:50 PM

This post shows how to use conditions to add the links - https://vborg.vbsupport.ru/showpost....6&postcount=28 See if that helps.

Anseur 12-01-2009 08:15 AM

I actualy tried that way of doing it too, what happens if with is, the if conditional just gets put in the navbar as plain text, as if vb is not seeing it as a conditional. I notice the syntax highlighting on the plug code input page also doesn't color the extra if statement in green like the if statement at the top for the 'this_script ==' one.

Here's my complete code for the navtab plugin:

Code:

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



                            <li class="popupmenu">
                                <a href="javascript://" class="popupctrl">Administration</a>
                                <ul class="popupbody popuphover">
if (is_member_of($vbulletin->userinfo, 5, 6, 13, 14)) 
{
                                        <li><a href="/25manwrathplus/admin/" target=dkp_frame>Eqdkp Admin Index</a></li>
                                        <li><a href="/25manwrathplus/plugins/ctrt/" target=dkp_frame>Import CTRA String</a></li>
                                        <li><a href="/25manwrathplus/admin/addiadj.php" target=dkp_frame>Do Adjustments</a></li>
}

                                </ul>
                            </li>


                        <li><a href="/25manwrathplus/listmembers.php?s="
target=dkp_frame>Standings</a></li>
                        <li><a href="/25manwrathplus/listraids.php?s="
target=dkp_frame>Raids</a></li>
                        <li><a href="/25manwrathplus/listevents.php?s="
target=dkp_frame>Events</a></li>
                        <li><a href="/25manwrathplus/listitems.php?s="
target=dkp_frame>items</a></li>
                        <li><a href="/25manwrathplus/listitems.php?s=&p=history"
target=dkp_frame>History</a></li>
                        <li><a href="/25manwrathplus/stats.php?s="
target=dkp_frame>Stats</a></li>
                        <li><a href="/25manwrathplus/plugins/raidplan/listraids.php?s="
target=dkp_frame>Raid Planner</a></li>
                        <li><a href="/25manwrathplus/plugins/raidplan/raidstats.php?s="
target=dkp_frame>Raid Planner Stats</a></li>


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

                                        <li><a href="/25manwrathplus/settings.php?mode=account" target=dkp_frame>Account Settings</a></li>
                                        <li><a href="/25manwrathplus/plugins/raidplan/usersettings.php" target=dkp_frame>Raid Planner Settings</a></li>
                                        <li><a href="/25manwrathplus/login.php?logout=true" target=dkp_frame>Log Out of Eqdkp</a></li>
                                        <li><a href="/25manwrathplus/login.php" target=dkp_frame>Log Into Eqdkp</a></li>

                                </ul>
                            </li>

                </ul> ';


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

I tried putting the conditional before the first <li> on the top most popup control, before the <a> just below it, and where you see it now. (with the bracket closed in the appropriate place in each instance. same thing happens on each occasion.

Only difference I can see in the example you gave and my version, is I'm trying to hide an entire popup control to non admins, your example just tries to hide a link.

Lynne 12-01-2009 02:34 PM

I'd suggest you start over with the plugin because you've totally messed up the structure of the submenu.

The reason why you are ending up with the condition showing up in the code is because you are putting it there. Look again at the code I wrote. You need to *end* your writing to the variable $tablinks, then do the condition and add to $tablinks if the condition is true, and then continue writing to it later on. But, you need to break out of writing to it in order to do the condition - you just put the condition right in the middle of it! Basically:
PHP Code:

$tablinks 'a bunch of stuff';
if (
is_member_of($vbulletin->userinfo561314))  
{
      
$tablinks .= 'more stuff if condition is true';
}
$tablinks .= 'and more stuff'


Anseur 12-01-2009 03:18 PM

Quote:

Originally Posted by Lynne (Post 1923559)
I'd suggest you start over with the plugin because you've totally messed up the structure of the submenu.

Nah, no need. It's not 'messed up' it's layout is exactly how I intend it to look, with multiple drop downs etc. It works perfectly without the condition in it.

Quote:

Originally Posted by Lynne (Post 1923559)
But, you need to break out of writing to it in order to do the condition - you just put the condition right in the middle of it! Basically:
PHP Code:

$tablinks 'a bunch of stuff';
if (
is_member_of($vbulletin->userinfo561314))  
{
      
$tablinks .= 'more stuff if condition is true';
}
$tablinks .= 'and more stuff'


From this example I understand. I'm not really a coder so I didn't understand what the $tablinks did, now with that example, I do.

Thanks again.

Lynne 12-01-2009 03:27 PM

Quote:

Originally Posted by Anseur (Post 1923575)
Nah, no need. It's not 'messed up' it's layout is exactly how I intent it to look, with multiple drop downs etc. It works perfectly without the condition in it.

Maybe I did something weird on my end, but when I tried it, it did some wacky things.

oooh em geee 12-02-2009 09:07 PM

I did everything you said in the first post, and it works perfectly. There is only one thing I can't figure out.

If I click the links below the button, link1.php for example, it doesn't keep that button selected. It highlights the forum button again.

Is there anyway I can put multiple "yourpage" names in that code so it keeps the button highlighted even when going to a page by clicking a link below the button?

if (THIS_SCRIPT == 'yourpage')

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

NVM fixed it

oooh em geee 12-02-2009 09:59 PM

1 Attachment(s)
I fixed the first issue I had, but I have another question. In my images you can see what I mean.

I want the second image, the affiliate one, to show home in front of it as well. Just like in the first image. How can I change that?

Like it says: Home > Frontpage

And the other one only says: Affiliates

Lynne 12-02-2009 10:40 PM

Quote:

Originally Posted by oooh em geee (Post 1924343)
I fixed the first issue I had, but I have another question. In my images you can see what I mean.

I want the second image, the affiliate one, to show home in front of it as well. Just like in the first image. How can I change that?

Like it says: Home > Frontpage

And the other one only says: Affiliates

That has nothing to do with this article - you are asking about the navbits code. You should ask for help modifying that code out in the main vb4 forums. (And actually, I believe it is a problem with your affiliates page and the way your wrote the navbits code, so you should post that part of your code when you ask for help.)

oooh em geee 12-02-2009 10:42 PM

I made a new thread about this. If you can help me please go here:
https://vborg.vbsupport.ru/showthrea...54#post1924354

JarkkoL 12-04-2009 07:31 PM

Okay, so I was able to add a link to the navbar with this tutorial. But when I click on the link I just got white page and not the result you have in the screenshot. I tried to add link.php from your other tutorial, but it didn't change anything. What am I doing wrong? Sorry for the noob question (:

Edit: Aah, nevermind. In the link.php I was using caps for the template name like in the test.php. Didn't realize it was the template name I created until now that I rechecked the code.

Lynne 12-04-2009 07:45 PM

This sounds like a problem from your custom page, not this tutorial. You should ask questions about the custom page in the other article, not here (it gets confusing if you mix up articles and problems).

thunderclap82 12-07-2009 11:10 PM

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

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


Lynne 12-07-2009 11:59 PM

No, you do not need to create your own vB page to use it. Right now, your code shows that your tab should be selected when you are on a page where THIS_SCRIPT is defined as podcast. Perhaps you meant to use something like this instead?
PHP Code:

if ($_REQUEST['do'] == 'podcast'


thunderclap82 12-08-2009 12:13 AM

Quote:

Originally Posted by Lynne (Post 1927055)
No, you do not need to create your own vB page to use it. Right now, your code shows that your tab should be selected when you are on a page where THIS_SCRIPT is defined as podcast. Perhaps you meant to use something like this instead?
PHP Code:

if ($_REQUEST['do'] == 'podcast'


So I should replace

Code:

if (THIS_SCRIPT == 'podcast')
with

Code:

if ($_REQUEST['do'] == 'podcast'
I tried this but get a PARSE error.

Maybe that's where I'm getting confused. How do you define a page as something like 'podcast'?

Lynne 12-08-2009 01:17 AM

If you replaced it with exactly what you wrote, then yes, you will get a parse error because you are missing the end parenthesis.

At the top of each vb page is something like this:
PHP Code:

define('THIS_SCRIPT''online'); 

That defines the page name. So, if you are going to have the tab highlight because you are on a specific page, that is the best method to use. But, you can use other valid conditions also as long as they don't interfere with the conditions to have another tab highlighted.

thunderclap82 12-08-2009 02:28 AM

Quote:

Originally Posted by Lynne (Post 1927082)
If you replaced it with exactly what you wrote, then yes, you will get a parse error because you are missing the end parenthesis.

At the top of each vb page is something like this:
PHP Code:

define('THIS_SCRIPT''online'); 

That defines the page name. So, if you are going to have the tab highlight because you are on a specific page, that is the best method to use. But, you can use other valid conditions also as long as they don't interfere with the conditions to have another tab highlighted.

Maybe I wasn't clear. Where do I find the pages where I need to replace the 'define'? I know you said at the top of every vB page, but where do I find those? Sorry if this is a novice question.

Lynne 12-08-2009 03:03 AM

Quote:

Originally Posted by thunderclap82 (Post 1927098)
Maybe I wasn't clear. Where do I find the pages where I need to replace the 'define'? I know you said at the top of every vB page, but where do I find those? Sorry if this is a novice question.

Did you look at any of the pages? The line I quoted in my last post is line
17 in the online.php page. And line 17 of the forum.php page defines THIS_SCRIPT for that page to be 'index'. And for content.php, THIS_SCRIPT is defined at 'vbcms'. I believe any page in vb that you can land on has got THIS_SCRIPT defined at the top. And you don't want to replace those lines, I'm not sure why you would think you would want to do that. Those lines are there so you can write conditions like the one I use for when you are on that page. If you wrote your own page, you would give it your own definition for THIS_SCRIPT.


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

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

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