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
  #92  
Old 04-02-2012, 03:39 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Nocturnal222 View Post
is this safe? no security holes?
The code posted in the first post is perfectly safe. You will need to make sure that all php code that you add yourself has no security holes if you add any.
Reply With Quote
  #93  
Old 05-14-2012, 07:21 AM
Winter Sonata Winter Sonata is offline
 
Join Date: Apr 2010
Posts: 232
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How can I control the order of the tabs?
Reply With Quote
  #94  
Old 05-14-2012, 11:33 AM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Winter Sonata View Post
How can I control the order of the tabs?
with the template hook names (check template navbar to see all available hooks) and the plugin execution order
Reply With Quote
  #95  
Old 05-22-2012, 02:25 PM
Dave234 Dave234 is offline
 
Join Date: Mar 2012
Posts: 256
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I copied and pasted the codes exactly as you have them ragteknews, and I got the tab on there, but it is blank. Also when I click it, it goes to a nonworking page. How can I label the tab "User Photos" and have it go to a gallery of random user photos?
Reply With Quote
  #96  
Old 05-22-2012, 02:51 PM
Christos Teriakis Christos Teriakis is offline
 
Join Date: Jul 2011
Location: Thessaloniki, Greece
Posts: 1,228
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Pitty, but seems that is not working with vB4.2. I'm not getting any error when I'm importing the product file, but there is no Tab in the bar.

Chris
Reply With Quote
  #97  
Old 07-29-2013, 12:03 AM
tiger tiger is offline
 
Join Date: Jul 2002
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone know how to make this work in 4.2?
Reply With Quote
  #98  
Old 07-29-2013, 01:19 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

4.2.1 has a Navigation Manager to do this without using this article.
Reply With Quote
  #99  
Old 07-29-2013, 11:09 PM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can user this for auto add tabs when write plugin?
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 10:10 AM.


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.05399 seconds
  • Memory Usage 2,313KB
  • 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
  • (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
  • (2)pagenav_pagelink
  • (9)post_thanks_box
  • (4)post_thanks_box_bit
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (2)postbit_attachment
  • (9)postbit_onlinestatus
  • (9)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_postinfo_query
  • fetch_postinfo
  • 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