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
  #52  
Old 12-29-2009, 04:27 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If there's a hook, yes
Reply With Quote
  #53  
Old 12-29-2009, 11:43 PM
4ums 4ums is offline
 
Join Date: Oct 2009
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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="clsid27CDB6E-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??
Reply With Quote
  #54  
Old 12-30-2009, 06:00 AM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There are some articles for own pages
https://vborg.vbsupport.ru/forumdisplay.php?f=242
Reply With Quote
  #55  
Old 12-30-2009, 06:09 AM
4ums 4ums is offline
 
Join Date: Oct 2009
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #56  
Old 12-30-2009, 06:15 AM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

https://vborg.vbsupport.ru/showthread.php?t=228112
https://vborg.vbsupport.ru/showthread.php?t=229194
Reply With Quote
  #57  
Old 12-30-2009, 06:39 AM
4ums 4ums is offline
 
Join Date: Oct 2009
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
Reply With Quote
  #58  
Old 01-01-2010, 06:21 PM
Vaupell's Avatar
Vaupell Vaupell is offline
 
Join Date: Apr 2008
Location: Esbjerg, Denmark
Posts: 1,036
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 ?
Reply With Quote
  #59  
Old 01-02-2010, 07:22 PM
Sworm Sworm is offline
 
Join Date: Feb 2008
Posts: 422
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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".
Reply With Quote
  #60  
Old 01-08-2010, 10:24 PM
toonysnn toonysnn is offline
 
Join Date: Sep 2006
Location: Texas
Posts: 511
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Sworm View Post
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.
Reply With Quote
  #61  
Old 01-10-2010, 06:19 PM
muratmunich muratmunich is offline
 
Join Date: Oct 2005
Location: Germany
Posts: 329
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
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 08:20 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.07539 seconds
  • Memory Usage 2,357KB
  • 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
  • (1)bbcode_code
  • (2)bbcode_html
  • (3)bbcode_php
  • (1)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