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 (with template) (https://vborg.vbsupport.ru/showthread.php?t=228313)

MaryTheG(r)eek 12-13-2009 02:24 PM

Quote:

Originally Posted by ragtek (Post 1929823)
[ot]
haven't you wrote that you've finished with the vB Community and don't want to code anything else?[/ot]

Marketing tips my dear:)

nubian 12-17-2009 06:51 PM

So I've been tinkering around with this tutorial and was close to raising the white flag of surrender because I could not understand this for the life of me.
So after long grueling hours, I've manage to figure things out and get things working...well sort of.

I've used Lynne's artcle "[HOW TO - vB4] Create a own vBulletin page" and managed to create an about us page.

My about us page named, "about.php" look like this...
PHP Code:

<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################

define('THIS_SCRIPT''aboutus_plug');
define('CSRF_PROTECTION'true);
// change this depending on your filename

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array('about_us',);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

$navbits construct_navbits(array('' => 'About Us'));
$navbar render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle 'My Page Title';

// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######

$templater vB_Template::create('aboutus_tmplt');
$templater->register_page_templates();
$templater->register('navbar'$navbar);
$templater->register('pagetitle'$pagetitle);
print_output($templater->render());
?>


My template page named, "aboutus_tmplt" looks like this...
Code:

{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
  <head>
    <title>{vb:raw vboptions.bbtitle}</title>
    {vb:raw headinclude}
  </head>
  <body>
   
    {vb:raw header}
   
    {vb:raw navbar}
   
    <h2 class="blockhead">About Us blockhead text</h2>
    <div class="blockbody">
      <div class="blockrow">
      About Us text here
      </div>
    </div>
   
    {vb:raw footer}
  </body>
</html>

My plug-in script named, "aboutus_plug" looks like this...
PHP Code:

if (THIS_SCRIPT == 'aboutus_plug')
{
$tabselected ' class="selected"';
$vbulletin->options['selectednavtab'] = 'About Us';
}
$template_hook['navtab_middle'] .= '<li'.$tabselected.'><a class="navtab" href="about.php">About Us</a>'.$tablinks.'</li>'

----------

It feels awesome when things just work!
Like they say, "If it ain't broken, don't fix it", well that's not how it is in my case because my knowledge of VB's coding is fairly basic so I feel like I may have butchered some things that weren't necessary.

What I'm concerned with is that I have no idea what this line of does in my plug-in code.
PHP Code:

$vbulletin->options['selectednavtab'] = 'About Us'

Because I could name it, "Foo" and it will still work.
Can anyone shed some light as what that line of code does?

Also what I'm hoping for is that if anyone can please verify that the lines of code I have posted are valid giving their respective names and all?
Any help will greatly be appreciated.

Thanks.

ragtek 12-17-2009 07:09 PM

1. because your template is called aboutus_tmplt you need
PHP Code:

$globaltemplates = array('aboutus_tmplt'); 

instead of
PHP Code:

$globaltemplates = array('about_us',); 

the other thing i don't understand. sorry(my english is horrible :( )

Chee Foo 12-22-2009 05:32 AM

1 Attachment(s)
Hi,

I have added the template and plugin. But there is no letters appearing in the navbar.
Can anyone help ?

My template code
<vb:if condition="$vboptions['selectednavtab'] == 'ragteknews'">
<li class="selected">
<a class="navtab" href="news.php{vb:raw session.sessionurl_q}">{vb:rawphrase ragtek_news}</a>
<ul class="floatcontainer">
<li><a href="#">#</a></li>
</ul>
</li>
<vb:else />
<li><a class="navtab" href="news.php{vb:raw session.sessionurl_q}">{vb:rawphrase ragtek_news}</a></li>
</vb:if>

Plugin
if (THIS_SCRIPT == 'ragteknews')
{
//set selected tab
$vbulletin->options['selectednavtab'] = 'ragteknews';
}
// add the "subtemplate" to the navbartemplate
$template_hook['navtab_middle'] .= vB_Template::create('ragtek_news_navbar')->render();

oechertigger 12-22-2009 06:35 AM

@Chee Foo

You have to define "ragtek_news" as a new Phrase in the AdminCP.
Then you will get the phrase you defined as the Tabname

ragtek 12-22-2009 06:44 AM

You could also write "my phrase" instead of using a phrase;)

Chee Foo 12-23-2009 12:42 AM

Quote:

Originally Posted by oechertigger (Post 1935212)
@Chee Foo

You have to define "ragtek_news" as a new Phrase in the AdminCP.
Then you will get the phrase you defined as the Tabname

What should I fill up in the fields under phrase manager ?
Phrase Type - Global ?
Product - vBulletin ?
Varname - ragtek_news ?
Text - ??

ragtek 12-23-2009 05:30 AM

Phrase Type: Global
Varname: A varname, which you will have to use in the template
Text: Yout text which will be shown in the template

Chee Foo 12-23-2009 02:23 PM

Thanks!! It works!

petermclane 12-29-2009 11:19 AM

Works for me! Awesome, ty sir.

What about changing the order of the tabs... I see that in this example the tab is set to navtab_middle.
If I wanted to switch this tab (now in position 2 out of 3) with the default 'what's new' tab (now in position 3 out of 3)
would I state navtab_right ?

TYTY

ragtek 12-29-2009 04:27 PM

If there's a hook, yes;)

4ums 12-29-2009 11:43 PM

Hey ragtek thanks for this i managed to create the button im doing an arcade on my site and did the button no probs but how do i create a page as when you press the button it leads no where im a little bit of a noob only been doing this 3 months an learning lol thanks in advance p.s i know i have to load the games to my server etc just working on that..

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

BTW think im getting there but i also need to add this html code to make the game work
<html>
<head>
<title>Pacman Advanced</title>
</head>
<body>
<center>
<h1>Pacman Advanced</h1>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="600" height="400">
<param name="movie" value="pacmanadv.swf">
<param name="quality" value="high">
<embed src="pacmanadv.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="600" height="400">
</embed>
</object>
<br>
<a href="http://www.startgames.ws">Online flash game</a>
</center>
</body>
</html>

Where would i add that? this is harder than i thought when i stared 12 hours ago lol.
Thanks.

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

Also how do i create a page for it to link to when you press the tab??

ragtek 12-30-2009 06:00 AM

There are some articles for own pages;)
https://vborg.vbsupport.ru/forumdisplay.php?f=242

4ums 12-30-2009 06:09 AM

Thanks ragtek but ive looked through everything bud ive been doing this 14 hours with no sleep so getting a little tired now.
i just wanted to know how a create a page forr the button to link to.
Thanks B.

ragtek 12-30-2009 06:15 AM

https://vborg.vbsupport.ru/showthread.php?t=228112
https://vborg.vbsupport.ru/showthread.php?t=229194

4ums 12-30-2009 06:39 AM

Ok great ragtek thank you very much big help think the second one is easiar but how would i direct the tab to that page sorry to be a pest but i am really new to all this and avin many sleepless nights learning while i have time off work great way to spend hols...:erm:

Vaupell 01-01-2010 06:21 PM

1 Attachment(s)
tx helped alot,

one problem on a board im getting these stange spacers
but only on the first line "always" as if the text is indent once.
and same result for various browsers..

Attachment 108759

Code:

<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: 10px">Gallery</a>
<ul class="popupbody popuphover">
<li><a style="color:{vb:stylevar navbar_selected_popup_body_a_Color}" href="http://www.google.com" target="_blank">Google</a></li>
<li><a style="color:{vb:stylevar navbar_selected_popup_body_a_Color}" href="http://www.google.com" target="_blank">Google</a></li>
</ul></li>

any idea ?

Sworm 01-02-2010 07:22 PM

Is not possible for a not coder user , to use this mod :(

Will be great if one of the vb.org coder release a "Generic addon Tabs" , with a working link that just must be changed..... "Ready to use".

toonysnn 01-08-2010 10:24 PM

Quote:

Originally Posted by Sworm (Post 1945255)
Is not possible for a not coder user , to use this mod :(

Will be great if one of the vb.org coder release a "Generic addon Tabs" , with a working link that just must be changed..... "Ready to use".

There already is one of those. vBH-Add Tabs.

muratmunich 01-10-2010 06:19 PM

I want to show TEST Menu Option only if $myvar is set to 1 (Usergroup Permission) but this is not working for me.
Could someone help me ?

PHP Code:

if (THIS_SCRIPT == 'xxx')  // also defined('ragteknews') possible
{
//set selected tab
    
$vbulletin->options['selectednavtab'] = 'ragteknews';
    
$myvar=$permissions['x1'] AND $vbulletin->bf_ugp['x1']['x2']; //MY VARIABLE
}
// add the "subtemplate" to the navbartemplate
$template_hook['navtab_middle'] .= vB_Template::create('ragtek_news_navbar')->render(); 

PHP Code:

<vb:if condition="$vboptions['selectednavtab'] == 'ragteknews'">
<
li class="selected">
    <
class="navtab" href="news.php{vb:raw session.sessionurl_q}">{vb:rawphrase ragtek_news}</a>
<
ul class="floatcontainer">
<
vb:if condition="$myvar"><li><a href="test.php">TEST</a></li></vb:if> 
</
ul>
</
li>
<
vb:else />
<
li><class="navtab" href="news.php{vb:raw session.sessionurl_q}">{vb:rawphrase ragtek_news}</a></li>
</
vb:if> 

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

Fixed it with Lynnes Article: https://vborg.vbsupport.ru/showthread.php?t=226914

gabrielt 01-21-2010 09:22 PM

Hello,

Adapted this to create a link to my main website:

Plugin "Main Website Button", on process_template_complete:

Code:

$template_hook['navtab_middle'] .= vB_Template::create('Link to Main Website')->render();
Template "Link to Main Website":

Code:

<vb:if condition="$vboptions['selectednavtab'] == 'mainwebsite'">
<li class="selected">
<a class="navtab" href="{vb:raw vboptions.homeurl}">{vb:raw vboptions.hometitle}</a>
<ul class="floatcontainer">
<li><a href="#">#</a></li>
</ul>
</li>
<vb:else />
<li><a class="navtab" href="{vb:raw vboptions.homeurl}">{vb:raw vboptions.hometitle}</a></li>
</vb:if>

Enjoy!

nsilva 01-27-2010 06:28 PM

How come when I click on the nav tab, it shows the Forum tab as selected and not the tab I created?

Lynne 01-27-2010 06:44 PM

Quote:

Originally Posted by nsilva (Post 1968227)
How come when I click on the nav tab, it shows the Forum tab as selected and not the tab I created?

Because you didn't make the condition a valid condition for your tab.

Chickenpotpie 03-10-2010 07:03 AM

Good article. It worked well. question. if I need to add more tabs do I need to make new templates and hooks?

-CP

Sarcoth 03-19-2010 04:57 PM

In case anyone is curious and you know how to create a permission group, here is how you can use that group to determine who can see the tab.

FIRST:
At the top of the plugin, add a variable for your permission group array:
PHP Code:

$accessgroups explode(','$vbulletin->options['permission_group_name']); 

SECOND:
At the bottom of the plugin, find the following line:
PHP Code:

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

Change it to:
PHP Code:

$templater vB_Template::create('template_navbar');
    
$templater->register('accessgroups'$accessgroups);
$template_hook['navtab_end'] .= $templater->render(); 

THIRD:
Open your template and add a line to the top and the bottom.
HTML Code:

<vb:if condition="is_member_of($bbuserinfo, $accessgroups)">
HTML Code:

</vb:if>
NOTE: I know you could just edit the current if condition with an AND, but I think that will just confuse some people.

Theda 03-21-2010 05:29 AM

I kind of modified this to try and use it with articles as "pages" with the tabs linked to articles.. (and it works, the tabs show as on).... but the HOME button is on too. Is there a way to set the home button to unselected?

Code:

$tabselected = '';
$tablinks = '';
if ($_GET ['r'] == '180-Roster')
{
    $vbulletin->options['selectednavtab']='Roster';
    $tabselected = ' class="selected"';
}
$template_hook['navtab_start'] .= '<li'.$tabselected.'><a class="navtab" href="content.php?r=180-Roster">ROSTER</a>'.$tablinks.'</li>' ;


Sarcoth 03-24-2010 12:47 PM

I finally figured out a way to add all my variables from my custom page to the navbar. I went about it in a sneaky way.

I first added the following code to my showroster.php file which allowed me to add all the registered variables I wanted to use:

PHP Code:

$accessgroups explode(','$vbulletin->options['showroster_access_groups']);
$navbarloc $vbulletin->options['showroster_navbar_loc'];

switch (
$navbarloc) {
    case 
'1':
        
$nbloc 'navtab_start'; break;
    case 
'2':
        
$nbloc 'navtab_middle'; break;
    case 
'3':
        
$nbloc 'navtab_end'; break;
}

if (
THIS_SCRIPT == 'showroster') {
    
$vbulletin->options['selectednavtab'] = 'showroster'
}

$templater vB_Template::create('showroster_navbar');
    
$templater->register('sorturl'$sorturl);
    
$templater->register('accessgroups'$accessgroups);
    
$templater->register('columns'$columns);
    
$templater->register('sortgroupfield'$sortgroupfield);
    
$templater->register('oppositesort'$oppositesort);
$template_hook[$nbloc] .= $templater->render(); 

Since that was a close repeat to the code in my plugin, I ended up having one Roster button when on another tab and two when viewing the roster. I tried to remove the plugin, but that then caused the button to be missing when on another page; although it was there when on the roster. It makes sense after the fact. So, after some thought, I changed my plugin to the following:

PHP Code:

if (THIS_SCRIPT != 'showroster') {
$accessgroups explode(','$vbulletin->options['showroster_access_groups']);
$navbarloc $vbulletin->options['showroster_navbar_loc'];
$navbarorder $vbulletin->options['showroster_navbar_order']; 

switch (
$navbarloc) {
    case 
'1':
        
$nbloc 'navtab_start'; break;
    case 
'2':
        
$nbloc 'navtab_middle'; break;
    case 
'3':
        
$nbloc 'navtab_end'; break;
}

$templater vB_Template::create('showroster_navbar');
    
$templater->register('accessgroups'$accessgroups);
$template_hook[$nbloc] .= $templater->render();


That allowed me to use the plugin code when not on the roster page. When on the roster page, this code doesn't work, but the code from my showroster.php does. I then set up my showroster_navbar template to include the variables from my .php file and they work very well.

HTML Code:

<vb:if condition="is_member_of($bbuserinfo, $accessgroups)">
<vb:if condition="$vboptions['selectednavtab'] == 'showroster'">
<li class="selected">
        <a class="navtab" href="showroster.php{vb:raw session.sessionurl_q}">Roster</a>
        <ul class="floatcontainer">
                <li><a href="showroster.php{vb:raw session.sessionurl_q}">Default Sort</a></li>
                <li class="popupmenu">
                        <a href="javascript://" class="popupctrl">Sorting Options</a>
                        <ul class="popupbody popuphover">
                                <vb:if condition="$show[field1st]"><li><a href="{vb:raw sorturl}&amp;order=<vb:if condition="$sortgroupfield == $columns[column1]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts1}</vb:if>&amp;sortgroupfield={vb:raw columns.column1}">{vb:raw columns.title1}</a></li></vb:if>
                                <vb:if condition="$show[field2nd]"><li><a href="{vb:raw sorturl}&amp;order=<vb:if condition="$sortgroupfield == $columns[column2]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts2}</vb:if>&amp;sortgroupfield={vb:raw columns.column2}">{vb:raw columns.title2}</a></li></vb:if>
                                <vb:if condition="$show[field3rd]"><li><a href="{vb:raw sorturl}&amp;order=<vb:if condition="$sortgroupfield == $columns[column3]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts3}</vb:if>&amp;sortgroupfield={vb:raw columns.column3}">{vb:raw columns.title3}</a></li></vb:if>
                                <vb:if condition="$show[field4th]"><li><a href="{vb:raw sorturl}&amp;order=<vb:if condition="$sortgroupfield == $columns[column4]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts4}</vb:if>&amp;sortgroupfield={vb:raw columns.column4}">{vb:raw columns.title4}</a></li></vb:if>
                                <vb:if condition="$show[field5th]"><li><a href="{vb:raw sorturl}&amp;order=<vb:if condition="$sortgroupfield == $columns[column5]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts5}</vb:if>&amp;sortgroupfield={vb:raw columns.column5}">{vb:raw columns.title5}</a></li></vb:if>
                                <vb:if condition="$show[field6th]"><li><a href="{vb:raw sorturl}&amp;order=<vb:if condition="$sortgroupfield == $columns[column6]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts6}</vb:if>&amp;sortgroupfield={vb:raw columns.column6}">{vb:raw columns.title6}</a></li></vb:if>
                                <vb:if condition="$show[field7th]"><li><a href="{vb:raw sorturl}&amp;order=<vb:if condition="$sortgroupfield == $columns[column7]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts7}</vb:if>&amp;sortgroupfield={vb:raw columns.column7}">{vb:raw columns.title7}</a></li></vb:if>
                                <vb:if condition="$show[field8th]"><li><a href="{vb:raw sorturl}&amp;order=<vb:if condition="$sortgroupfield == $columns[column8]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts8}</vb:if>&amp;sortgroupfield={vb:raw columns.column8}">{vb:raw columns.title8}</a></li></vb:if>
                                <vb:if condition="$show[datejoinedcol]"><li><a href="{vb:raw sorturl}&amp;order=<vb:if condition="$sortgroupfield == 'joindate'">{vb:raw oppositesort}<vb:else />{vb:raw columns.sortsdj}</vb:if>&amp;sortgroupfield=joindate">{vb:rawphrase join_date}</a></li></vb:if>
                                <vb:if condition="$show[lastactivecol]"><li><a href="{vb:raw sorturl}&amp;order=<vb:if condition="$sortgroupfield == 'lastactive'">{vb:raw oppositesort}<vb:else />{vb:raw columns.sortsla}</vb:if>&amp;sortgroupfield=lastactive">{vb:rawphrase last_activity}</a></li></vb:if>
                        </ul>
                </li>
        </ul>
</li>
<vb:else />
<li><a class="navtab" href="showroster.php{vb:raw session.sessionurl_q}">Roster</a></li>
</vb:if>
</vb:if>

I'm not saying this is the best way, far from it. I would much rather have had a way to pull the data from my .php to the plugin and then use it in the template that way, but this works for now. I'll gladly accept a better way if someone can tell me. I'm sure I'm added more code than I need.

shooptek 03-25-2010 03:03 PM

Okay I am struggling with this. I want to add a button on my navbar that links to a specific forum, and when a user is viewing that forum for the tab on the navbar to be highlighted.

So this is the information that I used:

template name: bb_navbar_events

template code:
HTML Code:

<vb:if condition="$vboptions['selectednavtab'] == 'navbarevents'">
<li class="selected">
    <a class="navtab" href="forumdisplay.php?8-Events{vb:raw session.sessionurl_q}">{vb:rawphrase navbar_events}</a>
<ul class="floatcontainer">
<li><a href="#">#</a></li>
</ul>
</li>
<vb:else />
<li><a class="navtab" href="forumdisplay.php?8-Events{vb:raw session.sessionurl_q}">{vb:rawphrase navbar_events}</a></li>
</vb:if>


plugin code:
PHP Code:

if (THIS_SCRIPT == 'xxx')  // also defined('navbarevents') possible
{
//set selected tab
    
$vbulletin->options['selectednavtab'] = 'navbarevents';
}
// add the "subtemplate" to the navbartemplate
$template_hook['navtab_middle'] .= vB_Template::create('bb_navbar_events')->render(); 


Should this arrangement be working properly?

I want the Events tab to be highlighted when it is on that page, but the Forum tab remains highlighted.

Any suggestions?

Jaxel 04-05-2010 06:26 PM

How do you do PERMISSIONS with this? I use the following code for permissions in my mods, and it works fine...

Code:

if (!($permissions['medialibperms'] & $vbulletin->bf_ugp_medialibperms['cansubm']))
{
        print_no_permission();
}


I am trying to use this code in my plugin, but the permission ALWAYS fails...
Code:

if (THIS_SCRIPT == 'media')
{
        $vbulletin->options['selectednavtab'] = 'media';

        $categories = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "media_category");
        $submitperm = $permissions['medialibperms'] & $vbulletin->bf_ugp_medialibperms['cansubm'];

        while ($category = $vbulletin->db->fetch_array($categories))
        {
                $templater = vB_Template::create('media_NAVTAB_cat');
                $templater->register('categoryID', $category['categoryID']);
                $templater->register('catName', $category['catName']);
                $categorybits .= $templater->render();

                $templater = vB_Template::create('media_NAVTAB_sub');
                $templater->register('categoryID', $category['categoryID']);
                $templater->register('catName', $category['catName']);
                $submitbits .= $templater->render();
        }
}

$templater = vB_Template::create('media_NAVTAB');
$templater->register('categorybits', $categorybits);
$templater->register('submitbits', $submitbits);
$templater->register('submitperm', $submitperm);
$template_hook['navtab_middle'] .= $templater->render();

No matter what, $submitperm is always false...

unknown22 09-16-2010 07:57 PM

Where do I add these I know to create a new plugin?

RiskyBusin3ss 10-04-2010 07:39 PM

Hello,
I am a newbie, please help. Where do I create a template and how am I going to upload to my site.
Second, how do I suppose to "Create a plugin at the hook process_templates_complete" with PHP codes.

I am just really lost and do not know where to begin. Thank you.

Jack.rG 01-12-2011 12:10 AM

im new to this where do create a new templete

wpeloquin 02-16-2011 10:32 PM

Just wanted to say that i used a hybrid between yours and Lynne's walkthrough. I offloaded just the menu items to a template. Thanks for the help ragtek!

https://vborg.vbsupport.ru/showpost....&postcount=393

HMBeaty 03-13-2011 11:37 PM

Awesome! Thanks for this! Was slightly confused til I tried Lynne's instructions with adding a tab, then I came back to this one and understood (been away from vBulletin for quite awhile)

worried 04-04-2011 05:26 AM

Quote:

Originally Posted by gabrielt (Post 1962796)
Hello,

Adapted this to create a link to my main website:

Plugin "Main Website Button", on process_template_complete:

Code:

$template_hook['navtab_middle'] .= vB_Template::create('Link to Main Website')->render();
Template "Link to Main Website":

Code:

<vb:if condition="$vboptions['selectednavtab'] == 'mainwebsite'">
<li class="selected">
<a class="navtab" href="{vb:raw vboptions.homeurl}">{vb:raw vboptions.hometitle}</a>
<ul class="floatcontainer">
<li><a href="#">#</a></li>
</ul>
</li>
<vb:else />
<li><a class="navtab" href="{vb:raw vboptions.homeurl}">{vb:raw vboptions.hometitle}</a></li>
</vb:if>

Enjoy!

Exactly what I was looking for. :)

curriertech 04-04-2011 07:13 PM

This is a great tutorial! Does anyone know how I can retain the sublinks that show just below the tab bar on the forum tab, across all active tabs?

scorpionv 04-10-2011 04:00 PM

hi, great tutorial.

little question
my custom page is a clone of content that displays a list of articles on a given section, how can i make those links to point to my page 'news.php' instead of the default 'content.php'?

regards

Master Lucas 05-01-2011 01:57 AM

Is this as easy as adding a Drop down menu, I see those a lot

Daisyboo 07-27-2011 12:16 PM

Quote:

Originally Posted by gabrielt (Post 1962796)
Hello,

Adapted this to create a link to my main website:

Plugin "Main Website Button", on process_template_complete:

Code:

$template_hook['navtab_middle'] .= vB_Template::create('Link to Main Website')->render();
Template "Link to Main Website":

Code:

<vb:if condition="$vboptions['selectednavtab'] == 'mainwebsite'">
<li class="selected">
<a class="navtab" href="{vb:raw vboptions.homeurl}">{vb:raw vboptions.hometitle}</a>
<ul class="floatcontainer">
<li><a href="#">#</a></li>
</ul>
</li>
<vb:else />
<li><a class="navtab" href="{vb:raw vboptions.homeurl}">{vb:raw vboptions.hometitle}</a></li>
</vb:if>

Enjoy!

I tried this but nothing is showing. All I want is a button linking to another website :(:erm:

225 08-15-2011 09:43 PM

awesome, works great


All times are GMT. The time now is 10:55 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.01567 seconds
  • Memory Usage 1,966KB
  • 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
  • (11)bbcode_code_printable
  • (4)bbcode_html_printable
  • (13)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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