You are seeing this very light version of the page, as you are using an outdated browser! is done in XHTML 1.0 and supports CSS 2.0, please upgrade your browser if you want a better version of this site.

Thank you, please help us developers keep up with the industry rather than patching our code for outdated applications.

open or close right navigation

Flexible navigation with PHP

written by:Christian Heilmann on 26.04.2002
Jump to page: 1  2  3  4  5  or read all on one page

The page template.

1: <html>
2: <head>
3: <?
4:     $issite=explode("/",$HTTP_SERVER_VARS['REQUEST_URI']);
5:     $issite=explode(".",$issite[sizeof($issite)-1]);
6:     $d=ucwords(str_replace("_"," ",$issite[0]));
7: ?>
8:     <title >Our site - <?=$d?></title>
9:     <link rel="stylesheet" href="styles.css" type="text/css" />
10: </head>
11: <body>
12: <table border="0" cellpadding="4" cellspacing="0" width="100%">
13: <tr>
14:    <td bgcolor="#9999cc">
15:        <?include("nav.php")?>
16:    </td>
17: </tr>
18: </table>
19: </body>
20: </html>

line 4 gets the current URI and splits it at "/", we use that to get the name only.

line 5 splits that result at the "." to get rid of the extension

line 6 replaces every underscore in the name with a space and makes each word start with an uppercase character, this is for display reasons only.

line 8 adds this information to your page title, this way you don't need to hardcode the titles either.

in line 15 you include our navigation script.

Now you save the document with a name that is the same as it's display.

For example, if you want our script to display "About Us", you'll call the document "about_us.php".

Generate all your pages from this template and keep up this naming convention.

Beware: If the name of the document does not match the one in the list, the navigation script will not work.

The next step now is the navigation script.

Table of contents:

The navigation woe
How to gain flexibility
The page template.
The nav.php script
Download and known issues

Back to top




Click to decrease fontsizeClick to increase fontsize



sponsored by :



Help, donate via paypal




Link to us

copy the code here:

Powered by EasyCMS