PDA

View Full Version : Alt nav bar hack


Moonwolf
08 Jan 2002, 15:02
Hi all

Well, here goes my first v2 hack :)

This hack will replace the linear nav bar (Board Title > Category > Forum > sub forum) nav bar with a cascading one, where the categories drop down and indent.

Unfortunately, this hack will only change the navbar that is generated by vB, it won't change the hard coded nav bars in pages like the member list/profile. I still have to figure out how to do that.

The hack is clunky, probably could be done in 4 lines of code instead of what I've done it in, and be cleaner, but I've tested it down to a depth of 6 and it seems to work clean, and that's all that matters right now :)

I'm working on changing the hard coded sections to use the CP flag, so that this can work on the site and change if the CP changes.

Kathi

File: Post #41 (www.vbulletin.org/forum/showthread.php?postid=212291#post212291)
Demo: http://www.underlight.com/VBB

Installer file for latest version now at Post #41 (www.vbulletin.org/forum/showthread.php?postid=212291#post212291). If you have installed this before the timestamp of that post, you should be fine.

fonzerelli_79
08 Jan 2002, 15:22
have you got a demo?

Moonwolf
08 Jan 2002, 15:25
Originally posted by fonzerelli_79
have you got a demo?

Funny you should mention it, I came here to post an update because I forgot to put one in :)

There's a version of it at www.underlight.com/VBB

Kathi

fonzerelli_79
08 Jan 2002, 15:28
i think ill give it a bash
it looks good

cheers

fonzerelli_79
08 Jan 2002, 15:42
i did it word for word and nothing happened

do you think this is because i run vbportal?

Moonwolf
08 Jan 2002, 15:47
Originally posted by fonzerelli_79
i did it word for word and nothing happened

do you think this is because i run vbportal?

It could be, I don't run it so I don't know how it calls the navbar. You might want to go to your admin CP -> Options and set alt nav bar "Yes", even if it's currently set to "Yes". For some reason I had to submit options even with it already set to yes for it to work on mine.

Kathi

fonzerelli_79
08 Jan 2002, 16:29
i got it working

heres what i done

*set the nav bar settings to yes like you said
*wrapped the $altnavbits round a smallfont like this <smallfont>$altnavbits</smallfont>, to make the text to appear smaller (obviously)
* removed the spaces before the imagefolders in functions.php

the casvertline.gif doesnt look right though, see how its yellow instead of white

look at my attached image

Moonwolf
08 Jan 2002, 16:58
Originally posted by fonzerelli_79

the casvertline.gif doesnt look right though, see how its yellow instead of white


That's wierd. Maybe I did something wrong in photoshop. I'll check it out and see.

Kathi

fonzerelli_79
08 Jan 2002, 17:03
thanks - appreciate it

also, i didnt like the big white space which this new bar left at the right so i added a banner in this space using this code


<table border=0>
<tr>
<td align=left>
<smallfont>$altnavbits</smallfont>
</td>
<td align=right>
banner ad
</td>
</tr>
</table>


you can see what it looks like in the image attached

Moonwolf
08 Jan 2002, 17:08
Nice use. Underlight's nav buttons will be taking up the space on that site, but I don't know what anyone else is using, so I just leave it up to them.

Now if only you could see the light and admit that Albion rules :)

Kathi

fonzerelli_79
08 Jan 2002, 17:11
are you talking about albion rovers or stirling albion

Moonwolf
08 Jan 2002, 17:17
Plymouth Albion :P

Although I doubt they're in the FA anymore, they were kind of borderline a decade ago when I lived in Plymouth :)

Kathi

fonzerelli_79
08 Jan 2002, 17:25
down the old south west coast

dont know much about Plymouth (ive been to torquay though)

would i have to change that image in photoshop or would psp do

Moonwolf
08 Jan 2002, 17:49
It's a .gif, anything should do it. If you get it fixed, could you stick it up here? I only included the custom ones from when that site migrated from UBB to vB years ago, so they're probably not right for everyone anyways.

Kathi

fonzerelli_79
08 Jan 2002, 17:52
i probably wont get a chance to do it today but when i do, ill post them here

:)

Horizon
08 Jan 2002, 18:00
How do you add something to the setting field in the database, per your first set of directions???

Through MySQLAdmin?

Moonwolf
08 Jan 2002, 18:07
I used phpMyAdmin, select the database to modify (vbulletin or whatever you called it at install time).

A textarea box is there letting you manually run queries on the database. Just add the line to that and hit go and it'll update the database.

I'm going to try and get this out using the install_ script that tubedogg et al use, when I figure out how to add it to one of them :p

Kathi

Horizon
08 Jan 2002, 18:12
I have admin v 1 and I dont see a go button, I select the forum db and then the setting on the right side, but then dont see where to add it.....

Horizon
08 Jan 2002, 20:13
This has changed since the last version
In admin/functions.php:

Find:

code:--------------------------------------------------------------------------------
$altnavbits .= "<br>$altnavprefix<img src=\"{ imagesfolder}/cascade/casendline.gif\"><img src=\"{ imagesfolder}/cascade/casicon.gif\"> $val\n";
$altnavprefix .= "<img src=\"{ imagesfolder}/cascade/casvertline.gif\">";
}
--------------------------------------------------------------------------------

That is not in my functions.php cause I never did the intial release.....so where does it go?

I finally did the query using MySQLGUI of www.mysql.com worked great.

bokhalifa
08 Jan 2002, 22:28
good hack :)

Moonwolf
08 Jan 2002, 23:49
In my 2.2.1 functions.php file, it's in

function makenavbar

Look for


if ($altnavbar) {


which should be in that function declaration. My code replaces the string you can't find.

If you don't have that in your functions.php, then I don't think you have v2.2.1, unless your vBPortal over-wrote functions.php, in which case I have no idea, sorry. I'm fairly sure the forums rules say I can't post the entire function to look for here.

Kathi

Originally posted by Horizon
This has changed since the last version
In admin/functions.php:

Find:

code:--------------------------------------------------------------------------------
$altnavbits .= "<br>$altnavprefix<img src=\"{ imagesfolder}/cascade/casendline.gif\"><img src=\"{ imagesfolder}/cascade/casicon.gif\"> $val\n";
$altnavprefix .= "<img src=\"{ imagesfolder}/cascade/casvertline.gif\">";
}
--------------------------------------------------------------------------------

That is not in my functions.php cause I never did the intial release.....so where does it go?

I finally did the query using MySQLGUI of www.mysql.com worked great.

Horizon
09 Jan 2002, 00:38
I have 2.2.1 which is hte latest.....I will try this when I get back to work tomorrow.

Horizon
09 Jan 2002, 19:58
Ok I found it, but it did not work.


if ($altnavbar) {
$navbits = explode(gettemplate("nav_joiner"),$navbits);
while (list($key,$val)=each($navbits)) {if($key == 0) {$altnavbits = "<br><img src=\"{ imagesfolder}/cascade/casendline.gif\"><img src=\"{ imagesfolder}/cascade/casicon.gif\"> $val\n";
} elseif ($key == 1) {$altnavprefix = "<img src=\"{ imagesfolder}/cascade/casvertline.gif\"><img src=\"{ imagesfolder}/cascade/casendline.gif\">";
$altnavbits .= "<br>$altnavprefix<img src=\"{ imagesfolder}/cascade/casicon.gif\"> $val\n";
} else {$space_count = (13 * ($key - 1));
$altnavprefix = "<img src=\"{ imagesfolder}/cascade/casvertline.gif\"><img src=\"{ imagesfolder}/space.gif\" width=\"".$space_count."\" height=\"1\"><img src=\"{ imagesfolder}/cascade/casendline.gif\">";
$altnavbits .= "<br>$altnavprefix<img src=\"{ imagesfolder}/cascade/casicon.gif\"> $val\n";
}
}
eval("\$navbar = \"".gettemplate("navbaralt")."\";");
} else {
eval("\$navbar = \"".gettemplate("navbar")."\";");
}


IS this spaced right?

Moonwolf
09 Jan 2002, 20:06
Find

if ($altnavbar) {

Delete everything after that to:

eval("\$navbar = \"".gettemplate("navbaralt")."\";");

Then insert after the

if ($altnavbar) {

the following:

$navbits = explode(gettemplate("nav_joiner"),$navbits);
while (list($key,$val)=each($navbits)) {
if($key == 0) {
$altnavbits = "<br><img src=\"vbimages/cascade/casendline.gif\"><img src=\"vbimages/cascade/casicon.gif\">&nbsp;&nbsp;$val\n";
} elseif ($key == 1) {
$altnavprefix = "<img src=\"vbimages/cascade/casvertline.gif\"><img src=\"vbimages/cascade/casendline.gif\">";
$altnavbits .= "<br>$altnavprefix<img src=\"vbimages/cascade/casicon.gif\">&nbsp;&nbsp;$val\n";
} else {
$space_count = (13 * ($key - 1));
$altnavprefix = "<img src=\"vbimages/cascade/casvertline.gif\"><img src=\"vbimages/space.gif\" width=\"".$space_count."\" height=\"1\"><img src=\"vbimages/cascade/casendline.gif\">";
$altnavbits .= "<br>$altnavprefix<img src=\"vbimages/cascade/casicon.gif\">&nbsp;&nbsp;$val\n";
}
}


You should end up with a section that reads:

if ($altnavbar) {
$navbits = explode(gettemplate("nav_joiner"),$navbits);
while (list($key,$val)=each($navbits)) {
if($key == 0) {
$altnavbits = "<br><img src=\"vbimages/cascade/casendline.gif\"><img src=\"vbimages/cascade/casicon.gif\">&nbsp;&nbsp;$val\n";
} elseif ($key == 1) {
$altnavprefix = "<img src=\"vbimages/cascade/casvertline.gif\"><img src=\"vbimages/cascade/casendline.gif\">";
$altnavbits .= "<br>$altnavprefix<img src=\"vbimages/cascade/casicon.gif\">&nbsp;&nbsp;$val\n";
} else {
$space_count = (13 * ($key - 1));
$altnavprefix = "<img src=\"vbimages/cascade/casvertline.gif\"><img src=\"vbimages/space.gif\" width=\"".$space_count."\" height=\"1\"><img src=\"vbimages/cascade/casendline.gif\">";
$altnavbits .= "<br>$altnavprefix<img src=\"vbimages/cascade/casicon.gif\">&nbsp;&nbsp;$val\n";
}
}
eval("\$navbar = \"".gettemplate("navbaralt")."\";");
} else {
eval("\$navbar = \"".gettemplate("navbar")."\";");
}

return $navbar;


It looks like you have the original version in there, which I changed

Kathi

Horizon
09 Jan 2002, 20:10
Its not doing anything in the forum, I must be an idiot, I added the template called navbaralt and it includes this


<a href="java script:window.location=window.location"><img src="{ imagesfolder}/cascade/casicon.gif" border="0" align="middle" alt="$bbtitle : Powered by vBulletin version $templateversion"></a>
<normalfont><b><a href="index.php?s=$session[sessionhash]">$bbtitle</a></b></normalfont>
$altnavbits


Then I did the change to Functions.php in the admin folder and then saved those files....did I not do something right?

Moonwolf
09 Jan 2002, 20:46
I'm not sure, I know -I- did something -wrong- with the last set of instructions, I forgot to put a space after the {'s so it was giving you the wrong instructions. The block I say yo put after the if ($altnavbar) { part should read:

$navbits = explode(gettemplate("nav_joiner"),$navbits);
while (list($key,$val)=each($navbits)) {
if($key == 0) {
$altnavbits = "<br><img src=\"{ imagesfolder}/cascade/casendline.gif\"><img src=\"{ imagesfolder}/cascade/casicon.gif\"> $val\n";
} elseif ($key == 1) {
$altnavprefix = "<img src=\"{ imagesfolder}/cascade/casvertline.gif\"><img src=\"{ imagesfolder}/cascade/casendline.gif\">";
$altnavbits .= "<br>$altnavprefix<img src=\"{ imagesfolder}/cascade/casicon.gif\"> $val\n";
} else {
$space_count = (13 * ($key - 1));
$altnavprefix = "<img src=\"{ imagesfolder}/cascade/casvertline.gif\"><img src=\"{ imagesfolder}/space.gif\" width=\"".$space_count."\" height=\"1\"><img src=\"{ imagesfolder}/cascade/casendline.gif\">";
$altnavbits .= "<br>$altnavprefix<img src=\"{ imagesfolder}/cascade/casicon.gif\"> $val\n";
}
}


Take the space out after the {'s, and you should be set. Sorry about that.

Kathi

Lesane
09 Jan 2002, 20:56
Great hack! Thanks, i gonna install this one later.

Horizon
09 Jan 2002, 21:10
Still nothing....this sucks, I think I did not do somethign right.

Moonwolf
09 Jan 2002, 21:17
OK

Did you add the altnavbar variable to the database table setting?

Did you submit the control panel options page -twice- with the "Use Alternative Nav Bar" set yo "Yes"?

If you did and it's not working, and the instructions were followed, then it looks like the hack isn't compatible with vBPortal.

Kathi

Horizon
09 Jan 2002, 21:18
LOL I dont have portal, but I did not do the thing with the control panel, where is that?

Moonwolf
09 Jan 2002, 21:24
*whimper*

Guess who forgot a step in the instructions :(

When you ran the database query in the instructions, you set up a control panel flag to tell the system to use the alternative nav bar instead of the linear one ...

Go to your admin CP, in the 5th section down will be an entry "Alternative Nav Bar". Select "Yes" for that, then submit the chaanges, then click on control panel again and submit it again. For some reason, it didn't take for some people on the first submit.

Then you should be running :p

Kathi
post 1 updated to reflect my being blonde

Horizon
09 Jan 2002, 21:26
OK it works now, just the icons do not show up right.....any idea they are broken links

here is a broken link

http://rikernet/forum/{%20imagesfolder}/cascade/casicon.gif

Moonwolf
09 Jan 2002, 21:36
Did you download cascade.zip and put the 3 image files in it in your folder images/cascade?

Kathi

Horizon
09 Jan 2002, 21:50
ok I had to change your image links...one does not work still though....here is the code, am I missing something?


if ($altnavbar) {
$navbits = explode(gettemplate("nav_joiner"),$navbits);
while (list($key,$val)=each($navbits)) {
if($key == 0) {
$altnavbits = "<br><img src=\"images/casendline.gif\"><img src=\"images/casicon.gif\"> $val\n";
} elseif ($key == 1) {
$altnavprefix = "<img src=\"images/casvertline.gif\"><img src=\"images/casendline.gif\">";
$altnavbits .= "<br>$altnavprefix<img src=\"images/casicon.gif\"> $val\n";
} else {
$space_count = (13 * ($key - 1));
$altnavprefix = "<img src=\images/casvertline.gif\"><img src=\"images/space.gif\" width=\"".$space_count."\" height=\"1\"><img src=\"images/casendline.gif\">";
$altnavbits .= "<br>$altnavprefix<img src=\"images/casicon.gif\"> $val\n";
}
}
eval("\$navbar = \"".gettemplate("navbaralt")."\";");
} else {
eval("\$navbar = \"".gettemplate("navbar")."\";");
}

return $navbar;



THE TOP IMAGE STILL COMES UP WITH THIS

http://rikernet/forum/{%20imagesfolder}/cascade/casicon.gif

Horizon
09 Jan 2002, 21:55
screenshot

Moonwolf
09 Jan 2002, 22:03
Ummmm, that %20 means you didn't take the space out after a {


Check your navaltbar template code.


Kathi

Horizon
09 Jan 2002, 23:55
Yes but where does that space come from?? I posted my exact code from the functions.php up there.....any ideas? It looks great so far.

Moonwolf
10 Jan 2002, 00:52
Check both the code to inout into the .php file and the code in your templastes. It looks a lot like you have a { imagesfolder} line instead of an {\imagesfolder} line (\ added to try and get around that being parsed)

Horizon
10 Jan 2002, 14:09
<a href="java script:window.location=window.location"><img src="images/casicon.gif" border="0" align="middle" alt="$bbtitle : Powered by vBulletin version $templateversion"></a>
<normalfont><b><a href="index.php?s=$session[sessionhash]">$bbtitle</a></b></normalfont>
$altnavbits


I had to take out the space before imagesfolder, and the cascade after it.

Great hack, now that I got it to work....

Horizon
10 Jan 2002, 14:15
Here is an XP folder if you want to change the blue one.....

: ) Just thought I would add this for my troubles

Moonwolf
10 Jan 2002, 18:31
OK, I managed to get an installer together, so here is the current working release. If there's no more problems I'll stick it out into the general population and see how it does :)

Kathi

nuke
16 Jan 2002, 21:19
The Hack goes also in 2.2.0?? Because I see nix. Thanked

nuke
18 Jan 2002, 21:20
Also dieser Hack Läuft überhaupt nicht.

Kann mir mal einer den Quelltext für die Temlate Posten?
Ich habe mir den Hack zwar runtergeladen aber beim Installieren wir nix angezeigt??

Mad
22 Jan 2002, 16:26
Ich hab den Hack auch eingebaut funzt aber nicht
genau nach Anleitung.
In der function.php alles schon ausprobiert.
Gibt es irgendwie einen anderere code für das vb2.2.1

gruss
Mad

pogo
23 Jan 2002, 11:47
Looks like a typo during the template installation.

In admin/functions.php changeeval("\$navbar = \"".gettemplate("navbaralt")."\";");toeval("\$navbar = \"".gettemplate("navaltbar")."\";");