vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Programming Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=188)
-   -   How To Add Additional Links To Your Navbar (https://vborg.vbsupport.ru/showthread.php?t=118924)

peterska2 06-17-2006 10:00 PM

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

ckandes1 06-24-2006 05:05 AM

I hadn't even thought of it, but i could really use this. thanks alot, great writeup!

brownbabe 08-16-2006 10:09 PM

Where exactly do I put adding link line?

peterska2 08-17-2006 01:04 AM

The most popular place is either immediately before or after the calendar link.

The code for the link is the last code block in part one.

Sangrun 08-26-2006 06:15 AM

Thanks! I was having trouble with that. I now have a second row and more links.

Thanks to all the great people who take their time to post this stuff,

dodgeboard.com 09-24-2006 10:27 PM

Awesome. Thanks for that little turorial. Helped me a lot!!

Harley-Heaven 10-01-2006 08:23 AM

Can you tell me how I can set the navbar so that it is fluid in size, depending on the users browsing window and browser software. At present my NavBar hangs over the edge of the window, is there a simple code to auto resize the NavBar?

Thanks very much
Harley

peterska2 10-01-2006 12:54 PM

links do not wrap in the navbar so if it is getting too long to fit then use 2 rows

Harley-Heaven 10-02-2006 08:46 AM

Thanks Peterska, that's exactly what I did, looks nice and aesthetic. Being a newbie, I just wondered if it was possible to make the bar liquid....

Sitting 07-23-2007 05:41 PM

thanks from the clumsy people...

CasualConvo 09-13-2007 09:30 PM

I put a "Home" link before the UserCP link in the Navbar but though it works fine, it's the only link that keeps the line underneath the text when all the others only do it on a mouseover. How can I fix this? Thank you!

Nevermind. All I had to do was refresh my page. Working great. Thank you!

kollam003 09-23-2007 04:31 AM

wow wow and just wow thanks

citroenar 10-06-2007 10:30 PM

where can I change a text size of a links in navbar?

Mr. Burns 10-08-2007 01:43 AM

I have added new links, however the font face, size and color do not match what was already there. Any hints to help resolve this?

Jasem 04-23-2008 08:12 PM

Thank you :)

PurpleButterfly 04-27-2008 06:44 PM

So helpful, thank you!! :D

Dantenator 06-04-2008 03:43 PM

In vb3.7, how would one define a navbar link to only show for specified usergroups? I'm currently using <if condition="in_array($bbuserinfo['usergroupid'], array(6))"> wrapped around the navbar link but I have additional usergroups setup for various things. I found the additional usergroups are stored in the membergroupids field. I tried changing $bbuserinfo['usergroupid'] to $bbuserinfo['membergroupids'] but it doesn't work. What am I doing wrong?

/edit
Scratch this question. I found my answer. I needed to use <if condition="is_member_of($bbuserinfo, 5, 6, 7)">. I hope this helps someone.

willygeek 06-06-2008 11:05 PM

Hi Folk,

Maybe I'm a bit slow, but the only page I can find within VBulletin (3.7) to change to achieve an additional link is "vbulletin-style.xml"

However if I change this and upload it nothing changes on my site (yes, I do refresh, even tried closing and opening in a different browser).

So, my question is, am I changing the correct file, or should I be making the changes elsewhere?

The line I am adding is...
<td class="vbmenu_control"><a href="http://www.ulysses.org.nz/photopost">Photo Gallery</a></td>

My site is www.ulysses.org.nz/vbulletin

Cheers

William
New Zealand:confused:

Lee Roberts 06-06-2008 11:22 PM

Yea would be nice if we new what files we should be editing.

willygeek 06-06-2008 11:49 PM

I have now figured out how to do this, via the control Panel.

Cheers
William

Lee Roberts 06-07-2008 12:02 AM

1 Attachment(s)
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

maryx 06-29-2008 06:54 PM

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?

steve1966 07-14-2008 06:48 AM

thanks

natecoupons 08-07-2008 10:11 PM

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?

pranaysanghavi 08-08-2008 09:14 AM

Hi,

which is the template that we're talking here? where can we find it?

Mudo 08-08-2008 04:45 PM

Thanks so much.

Mysterious Ride 08-25-2008 03:30 PM

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?

silverado350 09-22-2008 02:14 PM

Where do I add this mod? Do I it In the CP? Where do I find it?

MyraB 11-04-2008 05:09 AM

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!

cisco123 11-04-2008 05:33 PM

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 (Post 1542721)
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?

24hourForum.com 12-05-2008 09:56 PM

Hi,

Quick question,

<if condition="$show[member]">link code from part one</if>

i have different membership levels and want this code to show for usergroup id: 2 and 11 to only see the link, how can i make this possible? presently all members see it

thank you

goxy63 12-11-2008 01:33 PM

I luv You Kerry-Anne
This helps me a LOT :D

Kel-D 12-11-2008 07:12 PM

Quote:

Originally Posted by MYCNCUK (Post 1542721)
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

Works perfectly! Thanks mate! :up:

Bobbrown 01-04-2009 06:22 PM

Thanks, seem ok n 3.7.4pl1

abqtj 01-23-2009 04:50 AM

Thanks for posting this!

raja811 01-25-2009 11:34 AM

thanks

bposner 02-07-2009 09:08 PM

Where is this done. Seems simple enough but new to this code. Where are we editing this please?

Thank you

Lynne 02-07-2009 09:14 PM

Quote:

Originally Posted by bposner (Post 1737328)
Where is this done. Seems simple enough but new to this code. Where are we editing this please?

Thank you

It should be in the navbar template (Admin CP > Style & Templates > Style Manager > find your style in the list > Edit Templates from teh dropdown > Go > then expand the template list by hitting <<>> )

bposner 02-07-2009 11:25 PM

Quote:

Originally Posted by Lynne (Post 1737330)
It should be in the navbar template (Admin CP > Style & Templates > Style Manager > find your style in the list > Edit Templates from teh dropdown > Go > then expand the template list by hitting <<>> )

Lynne,
Thank you very much for your quick reply.
I actually got that far before :) but didn't know what file/template to go to to actually list the code. :confused: I see the Navigation/Breadcrumb Templates and a list of four selections, but then I can't find what I'm look for .. I am in the right place, yes?
I am trying to do a simple thing, the sytle seems to have removed the "Forum" or Forum Display link to list all the forums and just trying to get it back

Thank you for your time
Bill

Lynne 02-08-2009 02:58 AM

Quote:

Originally Posted by bposner (Post 1737406)
Lynne,
Thank you very much for your quick reply.
I actually got that far before :) but didn't know what file/template to go to to actually list the code. :confused: I see the Navigation/Breadcrumb Templates and a list of four selections, but then I can't find what I'm look for .. I am in the right place, yes?
I am trying to do a simple thing, the sytle seems to have removed the "Forum" or Forum Display link to list all the forums and just trying to get it back

Thank you for your time
Bill

Do you see a template called 'navbar' under the Navigation /Breadcrumb templates? That is the template you need to modify for the navigation bar. If you have another style, it could be that they don't have the navigation in the navbar template. In that case, you need to figure out which template they put them in. To find the template, do this - vboptions > General Settings > Add Template Name in HTML Comments > set to Yes . Then go back to your page and view the source code and you will see the name of the template called around your part of the code. Sometimes the template is the one mentioned at the very top of the page source.


All times are GMT. The time now is 04:20 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01401 seconds
  • Memory Usage 1,855KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (13)bbcode_code_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete