Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 4 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
[HOW TO - vB4] Create a New Tab in the navbar (with template)
ragtek
Join Date: Mar 2006
Posts: 1,630

 

austria, croatia
Show Printable Version Email this Page Subscription
ragtek ragtek is offline 11-17-2009, 10:00 PM

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>
2. Create a plugin at the hook process_templates_complete
PHP Code:
if (THIS_SCRIPT == 'xxx')  // also defined('ragteknews') possible
{
//set selected tab
    
$vbulletin->options['selectednavtab'] = 'ragteknews';
}
// add the "subtemplate" to the navbartemplate
$template_hook['navtab_middle'] .= vB_Template::create('ragtek_news_navbar')->render(); 
As you see, i've defined "ragteknews" on my news.php page.If ragteknews is defined, $vbulletion->options['selectednavtab'] will be set to ragteknews.
Thats important because where using a condition in the template:
HTML Code:
<vb:if condition="$vboptions['selectednavtab'] == 'ragteknews'">
Attached Images
File Type: png Forums_1258596385528.png (7.9 KB, 0 views)
File Type: png Forums - News_1258596373538.png (11.1 KB, 0 views)
Reply With Quote
  #72  
Old 10-04-2010, 07:39 PM
RiskyBusin3ss RiskyBusin3ss is offline
 
Join Date: Sep 2010
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #73  
Old 01-12-2011, 12:10 AM
Jack.rG Jack.rG is offline
 
Join Date: Nov 2010
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

im new to this where do create a new templete
Reply With Quote
  #74  
Old 02-16-2011, 10:32 PM
wpeloquin wpeloquin is offline
 
Join Date: May 2006
Location: Behind you...
Posts: 143
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #75  
Old 03-13-2011, 11:37 PM
HMBeaty's Avatar
HMBeaty HMBeaty is offline
 
Join Date: Sep 2005
Posts: 4,141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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)
Reply With Quote
  #76  
Old 04-04-2011, 05:26 AM
worried worried is offline
 
Join Date: Jan 2009
Posts: 80
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by gabrielt View Post
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.
Reply With Quote
  #77  
Old 04-04-2011, 07:13 PM
curriertech curriertech is offline
 
Join Date: Aug 2005
Location: NH
Posts: 121
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #78  
Old 04-10-2011, 04:00 PM
scorpionv scorpionv is offline
 
Join Date: Apr 2008
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #79  
Old 05-01-2011, 01:57 AM
Master Lucas Master Lucas is offline
 
Join Date: Apr 2011
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is this as easy as adding a Drop down menu, I see those a lot
Reply With Quote
  #80  
Old 07-27-2011, 12:16 PM
Daisyboo Daisyboo is offline
 
Join Date: Jul 2008
Location: Somerset UK
Posts: 174
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by gabrielt View Post
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:
Reply With Quote
  #81  
Old 08-15-2011, 09:43 PM
225's Avatar
225 225 is offline
 
Join Date: Jul 2011
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

awesome, works great
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:18 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05198 seconds
  • Memory Usage 2,341KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (4)bbcode_code
  • (2)bbcode_html
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (4)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (2)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete