The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
[HOW TO - vB4] Create a New Tab in the navbar (with template)
I know that lynne allready postet an article, but here's a other way: This tutorial will show you, how to add own links to your navbar. (In the tutorial i'll use the code for my news add-on) 1. create a template (ragtek_news_navbar) HTML 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> PHP Code:
Thats important because where using a condition in the template: HTML Code:
<vb:if condition="$vboptions['selectednavtab'] == 'ragteknews'">
|
#62
|
|||
|
|||
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(); 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> |
#63
|
|||
|
|||
How come when I click on the nav tab, it shows the Forum tab as selected and not the tab I created?
|
#64
|
||||
|
||||
Because you didn't make the condition a valid condition for your tab.
|
#65
|
|||
|
|||
Good article. It worked well. question. if I need to add more tabs do I need to make new templates and hooks?
-CP |
#66
|
|||
|
|||
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:
At the bottom of the plugin, find the following line: PHP Code:
PHP Code:
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>
|
#67
|
|||
|
|||
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>' ; |
#68
|
|||
|
|||
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:
PHP Code:
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}&order=<vb:if condition="$sortgroupfield == $columns[column1]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts1}</vb:if>&sortgroupfield={vb:raw columns.column1}">{vb:raw columns.title1}</a></li></vb:if> <vb:if condition="$show[field2nd]"><li><a href="{vb:raw sorturl}&order=<vb:if condition="$sortgroupfield == $columns[column2]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts2}</vb:if>&sortgroupfield={vb:raw columns.column2}">{vb:raw columns.title2}</a></li></vb:if> <vb:if condition="$show[field3rd]"><li><a href="{vb:raw sorturl}&order=<vb:if condition="$sortgroupfield == $columns[column3]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts3}</vb:if>&sortgroupfield={vb:raw columns.column3}">{vb:raw columns.title3}</a></li></vb:if> <vb:if condition="$show[field4th]"><li><a href="{vb:raw sorturl}&order=<vb:if condition="$sortgroupfield == $columns[column4]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts4}</vb:if>&sortgroupfield={vb:raw columns.column4}">{vb:raw columns.title4}</a></li></vb:if> <vb:if condition="$show[field5th]"><li><a href="{vb:raw sorturl}&order=<vb:if condition="$sortgroupfield == $columns[column5]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts5}</vb:if>&sortgroupfield={vb:raw columns.column5}">{vb:raw columns.title5}</a></li></vb:if> <vb:if condition="$show[field6th]"><li><a href="{vb:raw sorturl}&order=<vb:if condition="$sortgroupfield == $columns[column6]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts6}</vb:if>&sortgroupfield={vb:raw columns.column6}">{vb:raw columns.title6}</a></li></vb:if> <vb:if condition="$show[field7th]"><li><a href="{vb:raw sorturl}&order=<vb:if condition="$sortgroupfield == $columns[column7]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts7}</vb:if>&sortgroupfield={vb:raw columns.column7}">{vb:raw columns.title7}</a></li></vb:if> <vb:if condition="$show[field8th]"><li><a href="{vb:raw sorturl}&order=<vb:if condition="$sortgroupfield == $columns[column8]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts8}</vb:if>&sortgroupfield={vb:raw columns.column8}">{vb:raw columns.title8}</a></li></vb:if> <vb:if condition="$show[datejoinedcol]"><li><a href="{vb:raw sorturl}&order=<vb:if condition="$sortgroupfield == 'joindate'">{vb:raw oppositesort}<vb:else />{vb:raw columns.sortsdj}</vb:if>&sortgroupfield=joindate">{vb:rawphrase join_date}</a></li></vb:if> <vb:if condition="$show[lastactivecol]"><li><a href="{vb:raw sorturl}&order=<vb:if condition="$sortgroupfield == 'lastactive'">{vb:raw oppositesort}<vb:else />{vb:raw columns.sortsla}</vb:if>&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> |
#69
|
|||
|
|||
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:
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? |
#70
|
|||
|
|||
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(); |
#71
|
|||
|
|||
Where do I add these I know to create a new plugin?
|
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|