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

Reply
 
Thread Tools
How To Add Additional Links To Your Navbar
peterska2
Join Date: Oct 2003
Posts: 6,504

 

Manchester, UK
Show Printable Version Email this Page Subscription
peterska2 peterska2 is offline 06-17-2006, 10:00 PM

There is one thing that you never seem to have enough of with a modified vBulletin site, and that is navbar space. This article covers how to add additional links to your navbar both on your regular one, and adding another row to it to stop it getting too busy. Also included in this article is showing and hiding links for guests and members.

Part One: Adding Links To Your Standard Navbar

Scenario used: You have a HTML page on your site with a map to the location of a regular meeting place for people from your site. You need to add the link to this page to your navbar for easy access by your visitors. This page is located at yoursite.com/map.html

To add a link to the additional page (it can be a page within vB or not even on your site) you need to use the following code:
Code:
<td class="vbmenu_control"><a href="http://yoursite.com/map.html" target="_blank">Map</a></td>
This code contains 4 important aspects.

Code:
<td class="vbmenu_control">
This tells you how the link will be displayed. Navbar links use the vbmenu_control class as defined in your CSS so they will always be in this format (Note: Some styles use different formats depending on the level of customization that has been carried out).


Code:
<a href="http://yoursite.com/map.html"
This tells us where the link is going to. You can link to a page anywhere on the internet by using this format. If the page you are linking to is in the same directory as your forums then you only need to use the page name, in this case map.html


Code:
target="_blank"
This tells your browser to open the link in a new window. If you want it to open in the same window then you simply miss this code out.


Code:
Map</a></td>
This displays the title of the link that will be displayed and also ends the link code and section in the navbar.


The best place to add the code for your additional link, is either immediately before or after the link to the calendar
Code:
<td class="vbmenu_control"><a href="calendar.php$session[sessionurl_q]">$vbphrase[calendar]</a></td>
Part Two: Creating Another Row In Your Navbar

If you have a number of modifications installed that have required additional links on your navbar, it quickly becomes very full. Now you can install a modification to add another navbar to your site, or you can simply create another row in your existing one.

When adding another row, it is important that you use a new table, otherwise your links will be forced into alignment with those on the top row, leaving an unsightly gap at the right side of the row.

In your navbar template, locate the following code:
Code:
<if condition="$show['member']">
            <td class="vbmenu_control"><a href="login.php?$session[sessionurl]do=logout&amp;logouthash=$bbuserinfo[logouthash]" onclick="return log_out()">$vbphrase[log_out]</a></td>
        </if>
    </tr>
    </table>
and add below
Code:
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="0" border="0" width="100%" align="center" style="border-top-width:0px">
    <tr align="center">
<td class="vbmenu_control"><a href="index.php">Sample Link</a></td>
</tr>
</table>
Now you have set up your extra row, you can start adding links to it.

First remove the Sample link from the code above by deleting that line from the template. Then using the method from Part One, add your new links to this row. You can move links from the top row by cutting and pasting them into the new row.


Part Three: Showing Links To Guests Or Members Only

There are some things that you really don't want guests to know about. After all, what is the point of showing a guest the link to the usercp when all they will get is a no permissions message? So what can you do about it? Wrapping the whole code for the link in an if conditional will only show the link to those who meet the criteria set.

To show a link to members only use:
Code:
<if condition="$show[member]">[high]link code from part one[/high]</if>
This literally means what it says. If you are a member, then show the link.

The same works for guests:
Code:
<if condition="$show[guest]">[high]link code from part one[/high]</if>
Using these two conditions, you can show and hide links to guests and members. Any links that do not use a condition will always show.



I hope that this helps with managing links on your navbar better. Feel free to ask any questions related to this.
Reply With Quote
  #22  
Old 06-07-2008, 12:02 AM
Lee Roberts's Avatar
Lee Roberts Lee Roberts is offline
 
Join Date: Jun 2008
Location: UK
Posts: 117
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The code below will give you a new navbar above and it will also look just like the other (correct borders and so on..)

This is for vB 3.7.1, change the links to what you would like them to be.

Code:
<!-- top nav links bar -->
<div class="tborder" style="padding:$stylevar[cellspacing]px; border-top-width:1px; border-bottom-width:0px">
    <table cellpadding="0" cellspacing="0" border="0" width="100%" align="center">
    <tr align="center">
        <td class="vbmenu_control"><a href="index.php?$session[sessionurl]">Home</a></td>
        <td class="vbmenu_control"><a href="online.php?$session[sessionurl]">$vbphrase[whos_online]</a></td>
        <td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getdaily">$vbphrase[todays_posts]</a></td>
        <td class="vbmenu_control"><a href="forumdisplay.php?$session[sessionurl]do=markread">$vbphrase[mark_forums_read]</a></td>
        <if condition="$show['member']">
        <td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=process&showposts=0&starteronly=1&exactname=1&searchuser=$bbuserinfo[username]">My Threads</a> / <a href="search.php?$session[sessionurl]do=process&showposts=0&exactname=1&searchuser=$bbuserinfo[username]">Replies</a></td>
        <td class="vbmenu_control"><a href="#" onclick="window.open('misc.php?$session[sessionurl]do=buddylist&amp;focus=1','buddylist','statusbar=no,menubar=no,toolbar=no,scrollbars  =yes,resizable=yes,width=250,height=300'); return false;">$vbphrase[open_buddy_list]</a></td>
        <td class="vbmenu_control"><a href="member.php?$session[sessionurl]u=$bbuserinfo[userid]">$vbphrase[my_profile]</a></td>
        </if>
        <if condition="$bbuserinfo[usergroupid] == 6">
        <td class="vbmenu_control"><a href="$admincpdir/index.php$session[sessionurl_q]">AdminCP</a></td>
        </if>
     </tr>
    </table>
</div>
<!-- / top nav links bar -->
Enjoy !

Demo: www.mycncuk.com
Attached Images
File Type: jpg vbnav.jpg (38.8 KB, 0 views)
Reply With Quote
  #23  
Old 06-29-2008, 06:54 PM
maryx maryx is offline
 
Join Date: Jan 2006
Posts: 116
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have 3 calendars on my forum. What do I do to remove the current Calendar link on the navbar and change it to a Calendars link with 3 drop down boxes.

I tried the mod here, and was able to add one drop down box, but not more, and the link didnt work. It looked good but didnt connect to anything.

Any help here?
Reply With Quote
  #24  
Old 07-14-2008, 06:48 AM
steve1966 steve1966 is offline
 
Join Date: Dec 2007
Posts: 504
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks
Reply With Quote
  #25  
Old 08-07-2008, 10:11 PM
natecoupons natecoupons is offline
 
Join Date: Jul 2008
Posts: 179
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This worked great for me....but I have a problem....with the new link in the navbar it opens a new window. How do I stop this?
Reply With Quote
  #26  
Old 08-08-2008, 09:14 AM
pranaysanghavi's Avatar
pranaysanghavi pranaysanghavi is offline
 
Join Date: Jun 2008
Location: India
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

which is the template that we're talking here? where can we find it?
Reply With Quote
  #27  
Old 08-08-2008, 04:45 PM
Mudo Mudo is offline
 
Join Date: Dec 2006
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks so much.
Reply With Quote
  #28  
Old 08-25-2008, 03:30 PM
Mysterious Ride's Avatar
Mysterious Ride Mysterious Ride is offline
 
Join Date: Feb 2008
Location: US
Posts: 53
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I can't seen to get to the HTML page for my site to try and make the changes. I keep getting the error page.

My Site:

www.ofagewizards.com/home

For the HTML map:

www.ofagewizards.com/map.html

Is there something I'm doing wrong?
Reply With Quote
  #29  
Old 09-22-2008, 02:14 PM
silverado350 silverado350 is offline
 
Join Date: Aug 2008
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Where do I add this mod? Do I it In the CP? Where do I find it?
Reply With Quote
  #30  
Old 11-04-2008, 05:09 AM
MyraB MyraB is offline
 
Join Date: Nov 2008
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you so much for this information.
You saved me so much time and pain.

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

Is there some way to space the links evenly along the navbar? Right now the new links I added seem to take up more room than the standard vBulletin links. I used the exact same code/tag format given at the top of this thread. Thanks very much!
Reply With Quote
  #31  
Old 11-04-2008, 05:33 PM
cisco123 cisco123 is offline
 
Join Date: Oct 2008
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

where exactly is this at?place is either immediately before or after the calendar link.
i added a second row but cant seem to add just a link

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

Quote:
Originally Posted by MYCNCUK View Post
The code below will give you a new navbar above and it will also look just like the other (correct borders and so on..)

This is for vB 3.7.1, change the links to what you would like them to be.

Code:
<!-- top nav links bar -->
<div class="tborder" style="padding:$stylevar[cellspacing]px; border-top-width:1px; border-bottom-width:0px">
    <table cellpadding="0" cellspacing="0" border="0" width="100%" align="center">
    <tr align="center">
        <td class="vbmenu_control"><a href="index.php?$session[sessionurl]">Home</a></td>
        <td class="vbmenu_control"><a href="online.php?$session[sessionurl]">$vbphrase[whos_online]</a></td>
        <td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getdaily">$vbphrase[todays_posts]</a></td>
        <td class="vbmenu_control"><a href="forumdisplay.php?$session[sessionurl]do=markread">$vbphrase[mark_forums_read]</a></td>
        <if condition="$show['member']">
        <td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=process&showposts=0&starteronly=1&exactname=1&searchuser=$bbuserinfo[username]">My Threads</a> / <a href="search.php?$session[sessionurl]do=process&showposts=0&exactname=1&searchuser=$bbuserinfo[username]">Replies</a></td>
        <td class="vbmenu_control"><a href="#" onclick="window.open('misc.php?$session[sessionurl]do=buddylist&amp;focus=1','buddylist','statusbar=no,menubar=no,toolbar=no,scrollbars  =yes,resizable=yes,width=250,height=300'); return false;">$vbphrase[open_buddy_list]</a></td>
        <td class="vbmenu_control"><a href="member.php?$session[sessionurl]u=$bbuserinfo[userid]">$vbphrase[my_profile]</a></td>
        </if>
        <if condition="$bbuserinfo[usergroupid] == 6">
        <td class="vbmenu_control"><a href="$admincpdir/index.php$session[sessionurl_q]">AdminCP</a></td>
        </if>
     </tr>
    </table>
</div>
<!-- / top nav links bar -->
Enjoy !

Demo: www.mycncuk.com
where do i add this?
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 04:05 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.05603 seconds
  • Memory Usage 2,348KB
  • 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
  • (12)bbcode_code
  • (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
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete