PDA

View Full Version : Navbar Mini-Hack


N!ck
02-21-2003, 10:00 PM
This mini-hack will add Forums to your navbar in folders and threads. This is useful if your forums are not the highest level of hierarchy on your site.

For example, if you have a thread title "Thread" in a forum "Folder", your navbar shows:

MySite.com Forums > Folder > Thread

But what if MySite.com is a thing of its own, and you want MySite.com to be the highest level in the hierarchy. This hack (combined with changing $bbtitle to your site title), will change that to:

MySite.com > Forums > Folder > Thread

It will only work in threads and forums, however, because I feel that the calendar, user cp, etc. are their own things and don't really need to be on a lower level than the forums. Also, these things can be edited in your templates if you really care.

If you don't understand what this does, feel free to ask.

Anyway, to do this little hack, open functions.php in your admin folder.

In functions.php, find:

$navbits=makenav($id,$idtype,$highlightlast);

if ($altnavbar) {
$navbits = explode(gettemplate("nav_joiner"),$navbits);
while (list($key,$val)=each($navbits)) {


Replace it with:

$nav_title="Forums";
$nav_url="forums.php?s=".$session[sessionhash];
eval("\$navbits = \"".gettemplate("nav_linkon")."\";");
eval("\$navbits .= \"".gettemplate("nav_joiner")."\";");

$navbits.=makenav($id,$idtype,$highlightlast);

if ($altnavbar) {
$navbits = explode(gettemplate("nav_joiner"),$navbits);
while (list($key,$val)=each($navbits)) {


Make sure you change forums.php to the name of whatever file your index.php was renamed to.

marcel-ea
02-22-2003, 03:03 AM
Work! Great

but on my 2.2.9

This line

navbits.=makenav($id,$idtype,$highlightlast);

is withount the point after navbits :)

N!ck
02-22-2003, 03:15 AM
ah, you're right...i need to modify my instructions a little bit. make sure you put that dot in or it won't work right.

Overgrow
02-22-2003, 02:34 PM
Excellent Nick! I always find myself frustrated on other people's vBs that don't have a clear link back to the home page. (vBulletin.com being one obvious example!) It's poor UI since most people enter through the home page and expect that to be the top level of breadcrumb navigation.

Dean C
02-22-2003, 02:49 PM
Awesome idea :)

- miSt

JulianD
02-22-2003, 03:42 PM
Remember that you should change other templates that don't use the makenavbar function to make the breadcrumb. But it's a really good idea! thanks!

N!ck
02-23-2003, 02:59 AM
Originally posted by JulianD
Remember that you should change other templates that don't use the makenavbar function to make the breadcrumb. But it's a really good idea! thanks!

Actually, I thought of that, but I don't agree. Things like the calendar or user control panel should be just under the top level in my opinion. It's just a matter of template editing if you want them to be below your forums.

N!ck
02-23-2003, 03:03 AM
Originally posted by Overgrow
Excellent Nick! I always find myself frustrated on other people's vBs that don't have a clear link back to the home page. (vBulletin.com being one obvious example!) It's poor UI since most people enter through the home page and expect that to be the top level of breadcrumb navigation.

wow, haven't seen anything from you in a long time...glad to see you're still around :)

thanks

Lacrosse Boy
02-23-2003, 07:38 PM
There only seems to be one problem with my hac of this: it shows it in the worng order. What do I do? Here's the example : http://www.metrodancecenter.com/vb/forumdisplay.php?s=&forumid=2

Thanks!! :classic:

FleaBag
02-25-2003, 12:55 AM
Shouldn't I get a little credit for this idea?

I posted it here (https://vborg.vbsupport.ru/showthread.php?s=&threadid=49134) days ago!

As far as I know www.dragonninja.co.uk was the first site to do this.

Bad Bunny
02-25-2003, 03:07 AM
Originally posted by Lacrosse Boy
There only seems to be one problem with my hac of this: it shows it in the worng order. What do I do? Here's the example : http://www.metrodancecenter.com/vb/forumdisplay.php?s=&forumid=2

Thanks!! :classic:

I beleive this hack assumes that you have renamed your forum index to another name, and instead have a different index in your forum folder. At least that is how I did it.

FleaBag
02-25-2003, 08:14 PM
I've worked out how to do this through templates, no file hacking required - and it works perfectly. :)

N!ck
03-05-2003, 09:32 PM
Originally posted by GamerForums
Shouldn't I get a little credit for this idea?

I posted it here (https://vborg.vbsupport.ru/showthread.php?s=&threadid=49134) days ago!

As far as I know www.dragonninja.co.uk was the first site to do this.

No. I don't care when you posted it, I never saw your post. I was making it for my new site and thought perhaps it would be useful to others.

If you've ever seen any of my hacks that were in response to requests, then you should know that I always give credit for the idea. I am sorry I happened to have the same idea, but I promise you that your post had nothing to do with it.

N!ck
03-05-2003, 09:37 PM
Originally posted by GamerForums
I've worked out how to do this through templates, no file hacking required - and it works perfectly. :)

Oh? Would you mind releasing it, or are you just B.S.'ing me?

amykhar
03-05-2003, 10:02 PM
Me too. Templates, that is.

In the navbar template, all you have to do is put the site url before the bburl. The BBURL is a static thing in all of the navbars, and you can put whatever you want in front of it.

Amy

N!ck
03-12-2003, 01:40 AM
Granted. That works. Only thing is that it applies to any file (i.e. an addon) that uses the navbar templates. If you don't have any such files, then your method is effective and easy.

N!ck
08-09-2003, 11:03 PM
But, to reiterate, template modifications will produce half-assed results.

Machone
05-07-2004, 06:35 PM
Any idea how to do this in vb3?

Spacefreak
07-25-2005, 04:13 AM
I'd am also spending a good deal of time trying to figure a way to make this work in vB3.0.7.

Any help would so be appreciated.