Welcome to Egypt Forums Mark forums read | Egypt Main Page
Egypt Forums
Arabic Movies



Articles Thread, How To Add Additional Links To Your Navbar in vBulletin; <div> How To Add Additional Links To Your Navbar There is one thing that you never seem to have enough ...

Short Link: http://forum.egypt.com/enforum/showthread.php?t=3358


Reply
LinkBack Thread Tools Display Modes
How To Add Additional Links To Your Navbar
 
 
The God Father
Developer's Avatar

Reply With Quote
 
Join Date: Jul 2008
Location: NDC
Posts: 5,425
10-09-2008, 06:49 PM
 
<div> How To Add Additional Links To Your Navbar

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:<div style="margin: 5px 10px;"> <div class="smallfont" style="margin-bottom: 2px;">Code:
PHP Code:
     <td class="vbmenu_control"><a href="http://yoursite.com/map.html" target="_blank">Map</a></td>
This code contains 4 important aspects.

<div style="margin: 5px 10px;"> <div class="smallfont" style="margin-bottom: 2px;">Code:
PHP 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).


<div style="margin: 5px 10px;"> <div class="smallfont" style="margin-bottom: 2px;">Code:
PHP 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


<div style="margin: 5px 10px;"> <div class="smallfont" style="margin-bottom: 2px;">Code:

PHP 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.


<div style="margin: 5px 10px;"> <div class="smallfont" style="margin-bottom: 2px;">Code:
PHP 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<div style="margin: 5px 10px;"> <div class="smallfont" style="margin-bottom: 2px;">Code:

PHP 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:<div style="margin: 5px 10px;"> <div class="smallfont" style="margin-bottom: 2px;">Code:
PHP 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<div style="margin: 5px 10px;"> <div class="smallfont" style="margin-bottom: 2px;">Code:
PHP 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:
<div style="margin: 5px 10px;"> <div class="smallfont" style="margin-bottom: 2px;">Code:

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

The same works for guests:
<div style="margin: 5px 10px;"> Code:
PHP Code:
     <if condition="$show[guest]">link code from part one</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.
__________________
I Love Walking In The Rain Cuz Nobody Know I'm Crying !!
 
 
 
Reply

Articles Thread, How To Add Additional Links To Your Navbar in vBulletin; <div> How To Add Additional Links To Your Navbar There is one thing that you never seem to have enough ...

Short Link: http://forum.egypt.com/enforum/showthread.php?t=3358


Bookmarks

Tags
add, additional, links, navbar


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing Navbar Box Leaving just the Text Developer Articles 1 07-05-2009 05:45 AM
Clock and Date in Navbar Developer Mods for 3.6.x 0 10-10-2008 03:25 PM
View Your Posts/Threads from Navbar Search Developer Mods for 3.7.x 0 25-09-2008 03:05 PM
Removing Navbar Box Leaving just the Text Developer Articles 0 10-09-2008 06:59 PM
How To Add Drop Down Menus To Your Navbar Developer Articles 0 10-09-2008 05:57 AM