PDA

View Full Version : Miscellaneous Hacks - Multiple Navbars


optrex
25 Sep 2006, 13:38
There is always a demand for increased navigation from your vB Board. This modification has been tested on 3.6.x, 3.7.x and 3.8.x

Hardcoding a menu is the best way to add the increased functionaility, without adding server load and queries. This template modificiation explains how to add additional simple navbars to your website. By utilising exisitng vB code from within the Navbar template, the menu will appear on all pages, including in add-ons such as vBa and Photoplog and Photopost.


A working expample can be found at Midlands Weather Forum (http://www.midlandsweather.org.uk/)

The basis of the navigation bar (refered to as the 'Main Code') is as follows:

<!-- nav2 buttons bar by Optrex-->

<div align="center">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="0" border="0" width="100%" align="center" style="border-top-width:0px">
<tr align="center">


<!--compile your links within this space, using the section types below -->


</tr>
</table>
</div>

<!-- / nav2 buttons bar by Optrex-->


To create a link visible to all usergroups add this code to replace the green section of the main code (above):
<td class="vbmenu_control"><a href="http://www.yoururlhere.com" >Title of your link</a></td>

To create a link visible only to members add this code to replace the green section of the main code (above):
<if condition="$show['member']">
<td class="vbmenu_control"><a href="http://www.yoururlhere.com" >Title of your link</a></td>
</if>

Placement is recommended above your existing navbar, due to the "drop down" lists.

Find the following line in your navbar template and place your compiled code above it.
<!-- nav buttons bar -->
<div align="center">

optrex
25 Sep 2006, 13:39
Links to useful hints and tips within this thread:

Adding an admin only link: http://www.vbulletin.org/forum/showpost.php?p=1092868&postcount=15
Border around navbar: http://www.vbulletin.org/forum/showpost.php?p=1083429&postcount=7
Make link open in new window: http://www.vbulletin.org/forum/showpost.php?p=1098039&postcount=22
Colour links: http://www.vbulletin.org/forum/showpost.php?p=1098057&postcount=23

Kaleem
25 Sep 2006, 14:44
Great come in handy :)

beduino
25 Sep 2006, 15:46
hi,
i will test and install - really useful!:D
tks
beduino

Reece^B
25 Sep 2006, 16:17
Great Hack Optrex.
Heres a screen shot to show my version. :)

bashy
25 Sep 2006, 21:20
Hi m8, i have put mine above the navbar and its missing the line above the top of the botton cell? www.bashys-place.com/forums top bar you'll see

Any ideas as to the code to add it please?

optrex
25 Sep 2006, 21:27
Hi Bashy, There are 2 ways round that the first is to remove the following coloured text

<!-- nav2 buttons bar by Optrex-->
<div align="center">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="0" border="0" width="100%" align="center" style="border-top-width:0px" >

or you can change the same coloured text to read 1px instead of 0px

bashy
25 Sep 2006, 21:48
Cheers m8, I added the 1 instead of removing it :)
All sorted now, thanks again!!

Hornstar
27 Sep 2006, 09:36
thanks for the tute. This is really helpful, I guess I could also add the navbar at the footer if I wanted right?

Could I also duplicate the current navbar so it shows in the footer? if so where should I add it?

Thanks

optrex
27 Sep 2006, 13:27
Yes the idea is you can create as many menu nars as you want. Because it's coded directly into the template there are no additional server loads or queries.

If you were putting it in the footer, I would choose to place it above
<!-- /content area table -->

Again be careful of the placement of drop downs if you are going to move/copy your original.

MJMoore
02 Oct 2006, 10:35
Just what I was looking for.. many thanks!

morrow
03 Oct 2006, 03:17
Thanks for the tip; it came in pretty handy!

smoknz28
03 Oct 2006, 19:58
Installed and definitely has saved me from my users getting frustrated of having to scroll to the right and back to the left. ;)

Thank you for sharing this with the rest of us. :D

dupont24
05 Oct 2006, 23:38
Thanks......:)

morrow
09 Oct 2006, 07:15
Something I'll add to this which I think is pretty useful... <at least it's been useful for me. :)>

The following will ad an 'ADMIN" link to your Navbar. Only admins will be able to see it.

under:
<!--compile your links within this space, using the section types below -->

add:
<if condition="$GLOBALS[show][admincplink]">
<td class="vbmenu_control"><a href="http://www.yoursite.com/forumdir/admincp/index.php?$session[sessionurl]">$vbphrase[admin]</a></td></if>

Hope you'll find it as useful as I do.

DPSR
09 Oct 2006, 07:28
Thanks Optrex, very usefull :)

optrex
09 Oct 2006, 08:41
Something I'll add to this which I think is pretty useful... <at least it's been useful for me. :)>

Thanks morrow, I'll add it to the hints and tips.

Of course its easy to see how this can be changed to "moderator" only too.

KevNJ
12 Oct 2006, 01:54
*uninstalls marky's multi menu due to not working with some mods/hacks*

*installs optrex mutple menu's*

works great thanks !

Reece^B
13 Oct 2006, 12:24
*uninstalls marky's multi menu due to not working with some mods/hacks*

*installs optrex mutple menu's*

works great thanks !

Same ;)

newbe_haselina
15 Oct 2006, 06:37
*uninstalls marky's multi menu due to not working with some mods/hacks*

*installs optrex mutple menu's*

works great thanks !

and "SAME" again :)

Just installed this hack on my test enviroment, because I'm perparing an upgrade to 3.6.2 and it works teriffic. thanks a lot for this hack.

because I'm no hero with this stuff, how can I change the color of the link? and is it possible to chose even the link opens in a new window or staying in the parent window? that's the point I would need some help :o

UncoderMom
15 Oct 2006, 23:33
*installed*

GREAT! Took only minutes!


Now what do I do to make some of these (but not all) open in a new window?

optrex
16 Oct 2006, 08:21
To open link in new window, add bold text:

<a href="http://www.yoururlhere.com" target="_blank" >Title of your link</a>

optrex
16 Oct 2006, 08:58
To make the link a different colour add the bold text, where cccccc is the html colour you want to use.

<a href="http://www.yoururlhere.com"> <font color="cccccc"> Title of your link</a> </font>

UncoderMom
16 Oct 2006, 13:09
Thank you very much!

Its looks nice and clean in my template too! I spot it right away! That will make for easy edit!

UncoderMom
16 Oct 2006, 13:14
To open link in new window, add bold text:

<a href="http://www.yoururlhere.com" target="_blank" >Title of your link</a>


Worked like a charm!

So much control this way! :)

newbe_haselina
17 Oct 2006, 04:47
Thanks optrex ... that's really awsome :P ... Thanks you very much for your help

Hull Driver
18 Oct 2006, 07:09
after spending many years with phpBB I am adjusting to this board that was a quick easy lesson on how things work on VB

excellent thank you:)

Al-Fateh
25 Oct 2006, 18:53
ok what template do all this coding go under?

optrex
25 Oct 2006, 19:23
ok what template do all this coding go under?
the answer to that question is in bold in the instructions

Al-Fateh
25 Oct 2006, 19:48
thanks working great

Al-Fateh
25 Oct 2006, 20:37
this is one of the best mods

midirtrider
27 Oct 2006, 07:46
Thanks for the info.. this is a great mod!

And something I deffiantly am glad I learned!

AllenMead
29 Oct 2006, 16:22
A silly question, but how do I get the new links I've added to the additional nav bar to line up to the left and not centred as I haven't got that many extra links can be seen here here (http://www.astra-mk2.com)

Excellent mod!

optrex
29 Oct 2006, 20:09
AllenMead, in the 4th line of code change <tr align="center"> to <tr align="left">

alawee.blawee
03 Nov 2006, 17:43
it doesn't work with the DJ Fluid style

hehe

http://www.vbulletin.org/forum/showthread.php?p=1110105&posted=1#post1110105

optrex
03 Nov 2006, 20:26
It would be very easy for me to say its a bug in that hack, especially as its not been updated since RC, but as I don't have it installed, if you want to pm me some template information, I'll take a look.

I am assuming the skin uses the parent navbar, rather than relying on its own - ie when you look at the templates in style DJ, the navbar template is yellow not red?

optrex
03 Nov 2006, 20:49
it doesn't work with the DJ Fluid style
hehe
http://www.vbulletin.org/forum/showthread.php?p=1110105&posted=1#post1110105

It does work, having just installed that skin in the fluid mode, it works fine. Like I say, you just need to modify the correct template for that style.

http://img299.imageshack.us/img299/7792/menuej7.th.jpg (http://img299.imageshack.us/my.php?image=menuej7.jpg)

alawee.blawee
04 Nov 2006, 07:51
Sir If you look at the pic you put you are gonna see that some options came twice
like by example User Cp


can we make anything different and pass this problem?

optrex
04 Nov 2006, 08:16
That is because the designer of the skin has placed his navigation in the header. Just remove that part of code from the header template, or refer back to the person who made the skin for more advice.

alawee.blawee
04 Nov 2006, 08:40
ok thanx

let's wait for the Designer he might help us i hope



regards

optrex
21 Nov 2006, 09:25
this mod has now been tested with 3.6.3

alawee.blawee
21 Nov 2006, 20:24
this mod has now been tested with 3.6.3

and its working so nice
i've tested it and added it with a style has an integrated navbar
look at the demo (http://www.mriraq.com/vb)


thanx opterx

optrex
10 Dec 2006, 14:52
tested with 3.6.4 and working fine ;)

highlan-cruise
11 Dec 2006, 22:12
is there a way of aligning both of the bars so that the links are aligned instead of staggered?

Magz
11 Dec 2006, 22:19
Hi, firstly great mod, id been looking for something like this for a while now.

The only problem ive noticed, is that i use mkportal, and the extra navbar, whils it works flawlessy in my forum pages, it doesnt appear on the mkportal home page.

How can i make it so that it does?

Thanks

optrex
12 Dec 2006, 10:33
is there a way of aligning both of the bars so that the links are aligned instead of staggered?

Cruise, the links are centered, so if you have the same number of links in both bars, they should not be "staggered". You could try creating blank links to help with the spacing.

The only problem ive noticed, is that i use mkportal, and the extra navbar, whils it works flawlessy in my forum pages, it doesnt appear on the mkportal home page.
How can i make it so that it does?


Magz, It sounds like mkportal doesn't use the navbar template. So you could try moving the nav bar code to the header. Or mkportal may use its own template system (like mkportal_navbar or mkportal_header for example). In which case you would need to drop the code into the relevant mkportal templates.

Let me know how you get on

The dman
12 Dec 2006, 12:11
optrex
Thanks for this just what the doctor ordered

How can I get the seam between the 2 navbars like your pic

Mine looks like this

optrex
12 Dec 2006, 14:53
Try this dman

style="border-top-width:0px" or style="border-bottom-width:0px"

depending on which border you wan to change - the number of px is the border width.

Placement can be seen as here.

Border around navbar: http://www.vbulletin.org/forum/showpost.php?p=1083429&postcount=7

gatorenvy
13 Dec 2006, 02:16
I am a complete newb to vbulletin. I just installed it today and would like to add this

my forum is www. gatorenvy .com

I just don't know where to find the navbar file to paste the code you provided. I'm just using the default style for now. I don't know where any of the style files are or the header or the navbar. Please help!

optrex
13 Dec 2006, 08:58
Hi Gatro,

Please click install on this thread to show you've installed the product, and to keep up to date with changes.

From your AdminCP
Styles and templates
Style Manager
In default style select "edit templates"
Scroll down to navigation /breadcrumb templates
Double click navbar.

This will get you to your navbar template. Copy and paste the code to a .txt file on your PC so that you can restore it easily if you mess it up.

Sarcoth
18 Dec 2006, 16:23
I noticed you can put <if condition="$show['member']"> if you want the link to be only viewable by registered users and <if condition="$GLOBALS[show][admincplink]"> for admins. I was wondering how I could go about making a link only viewable to certain membergroup, i.e. membergroup id 23 for instance.

My guess would be finding the code where the $show['member'] is original defined and add something similiar to that but for membergroup 23 only. Or is there a way to just set up a reference in the navbar template?

Thank you!

optrex
18 Dec 2006, 21:55
Sarcoth,

try this and let me know how you get on

<if condition="$bbuserinfo['usergroupid'] == '23'">
</if>

Sarcoth
19 Dec 2006, 18:23
Sarcoth,

try this and let me know how you get on

<if condition="$bbuserinfo['usergroupid'] == '23'">
</if>

Thanks for the reply optrex. I found something yesterday that actually worked.

<if condition="is_member_of($bbuserinfo, 23)"></if>

Found a few things that go along with it as well in this link (http://www.vbulletin.org/forum/showthread.php?t=98009); good stuff.

almqdad
14 Jan 2007, 14:25
hi every body

WHAT IF I WANT TO SHOW THE LINK TO MORE THAN ONE GROUP

LET SAY GROUP 5,6,7

WHAT WILL BE THE CODE

YOUR HELP WILL BE HIGHLY APPRECAITED

thincom2000
14 Jan 2007, 15:01
WHAT IF I WANT TO SHOW THE LINK TO MORE THAN ONE GROUP

LET SAY GROUP 5,6,7


You can use OR

For example:

<if condition="($bbuserinfo['usergroupid'] == '5') OR ($bbuserinfo['usergroupid'] == '6') OR ($bbuserinfo['usergroupid'] == '7')">
</if>

I think that's the simplest code you can do without making a file edit first.

Zowners
21 Jan 2007, 01:20
Awsome Mod
I Love It!

afmarko99
22 Jan 2007, 00:08
optrex,

Thanks for the great post. I do have one question though. I have Blak-Ice skin installed and don't see:

<!-- nav buttons bar -->
<div align="center">

in the navbar template. I am trying to install my additional navbar directly underneath the buttons. Currently it is attached to the welcome module. I put all my coding in the top of the navbar template but that doesn't work. See here:
www.thepublicenemy.net

What template do I need to modify for this to work?

optrex
22 Jan 2007, 06:35
Depending on the skin, you may have to modify your header

nureeves
08 Aug 2007, 16:33
Hii

would you please help me .. :D
I am newbie at coding and editing template.
Well first thing .. which template should I edit and which new script should i add?

optrex
08 Aug 2007, 16:38
edit your navbar template.

You dont need to add scripts as such, just add the code portions above to get what you need.

nureeves
12 Aug 2007, 16:57
This is what i've got. Did I miss something?

nureeves
12 Aug 2007, 19:00
and how to make multiple nav like shown below:

puregraf
14 Aug 2007, 04:32
opps wrong post

optrex
14 Aug 2007, 13:28
This is what i've got. Did I miss something?

yes, by the looks of things you have.

optrex
14 Aug 2007, 13:29
and how to make multiple nav like shown below:

copy the code multiple times. :)

nureeves
14 Aug 2007, 17:23
copy the code multiple times. :)

Hehe,
I mean, one of navigation above login form .. how to put on it?

optrex
14 Aug 2007, 17:34
in your navbar find
<!-- breadcrumb, login, pm info -->

and place your completed code ABOVE

z0diac
19 Jun 2008, 14:10
This doesn't seem to work in 3.7.1 -- all I want to do is add a link in my navbar to post #1 (my rules thread) and name the link RULES in the navbar.

optrex
26 Jun 2008, 22:25
works fine in 3.7.1, and 3.7.2
check your code to make sure you have no errors.

usmansabir
01 Jul 2008, 16:11
optrex .. thankx for such a great code.... no need to install any addons :D thankx

mattcaswell
19 Dec 2008, 22:02
Installed this today.. Works great.. can't get the font color to work as outlined in the additional code.. but I'm code stupid so I'm sure it's my fault.

optrex
05 Feb 2009, 01:10
Just to confirm this also works in 3.8 and 3.8.1

Yago
17 Feb 2009, 00:41
This mod made my day