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

Quote:

Originally Posted by Lynne (Post 2276892)
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 [DATE]1323682221[/DATE] at [TIME]1323682221[/TIME] ---------------

Quote:

Originally Posted by gm139 (Post 2276902)
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 [DATE]1323688580[/DATE] at [TIME]1323688580[/TIME] ---------------

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

Code:

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:

Code:

$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

Code:

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

PHP Code:

$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].
PHP Code:

<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:
PHP Code:

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

PHP Code:

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

And the error I get is:


Code:

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

Quote:

Originally Posted by malinghi (Post 2290906)
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:

PHP Code:

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

And the error I get is:


Code:

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

Code:


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

Code:

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

Quote:

Originally Posted by malinghi (Post 2290967)
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.

Code:

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


All times are GMT. The time now is 01:22 AM.

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

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02490 seconds
  • Memory Usage 1,771KB
  • 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
  • (8)bbcode_code_printable
  • (5)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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