Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

interested in PHP-navigation bar?


As posted before, I have some navigation bar script in javascript. Some people liked it a lot.
I have done some effort in translating it to PHP. Advantages: does not require javascript enabled on the client, and it helps search engines. I would like to know if people are interested. Because then I will update my .cty demo and make the script more accessible.

I am referring to the navigation bars on many professional sites which show you where you are (e.g. on On citydesk it uses folders and index files. If your citydesk layout looks like
> sub 1
              > sub 2
                  Some Article

Then the nav-bar will show
home > sub 1 > sub 2 > some article
with folder, sub1 and sub2 being hyperlinked to the index files.

Please let me know if you're interested

Adriaan van den Brand
Tuesday, August 27, 2002

I'd like to see it, Adriaan. I'm sure TK would be happy to post your demo on his site, like he has with other ones.

Darren Collins
Tuesday, August 27, 2002

I did the same thing but without any server-side scripting:

<b><a href="{$.home$}">Home</a> - <a href="{$.bookreviews$}">Book Reviews</a> - <a href="{$.link$}">{$.headline$}</a></b>

This requires a variable per category and different templates per category. It's really simple for small sites, though.

Patrick Ansari
Wednesday, August 28, 2002

check out test version...

compare with my javascript version:

The pages are dutch only, however it is about the line
Home > Trainingen > Workshops > Project-StartUp-workshop

in Citydesk it looks like

which expands to
<div align="left" id="navbar"><br>
<?php require_once 'PTMFOG0000000517.php';
  setNavTags('','','&nbsp;<img src="PTMFOG0000000300.gif">&nbsp;','');
  echo $topMenu."\n";

the setNavTags is optional; it is used to pass image references to the script. Defaults will use the ' > ' symbol rather than an image.

On my site I currently have php parsing enabled for html file; it should work on any php enabled site if you use the .php extension.

The other parameters of the setNavTags can be used to specify a {prev} and {next} page html tag, and the format of the hyperlinks in the menu.

The php script has a foreach loop including all index files in all folders.

Adriaan van den Brand
Wednesday, August 28, 2002

Sorry, to prevent the test site from getting crawled by robots and being linked to, I have made it password protected. It's easy: test / test.

Adriaan van den Brand
Thursday, August 29, 2002

*  Recent Topics

*  Fog Creek Home