My own server My Home page Sign Guestbook Read Guestbook
The Apache manual The PHP manual PHP examples (Core PHP Progr.) PHP examples (Pro. PHP Progr.) My own PHP exemples

PHP-test 7

How does the navigation bar work?


As an example we will look at the file "PHP Examples (My own)" < http://bohjohan.dyndns.orgtest/dir_e.php >

dir_e.php Click to see the code for that page (in a new window "newTestWin").


1:

The pop-up-button effect on the navigation bar is created with javaScript, in the beginning of the file are these lines:

<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!--
var jsNavBase = "../"
//-->
</SCRIPT>

<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="../navbt/button_updwn.js">
<!--
//-->
</SCRIPT>

First the variable "jsNavBase" is set, and then the file "button_updwn.js" is included. This file is used on all pages, and contains the pop-up-button script.

button_updwn.js Click to see the code in that file (in the new window "newTestWin").


2:

Then we have this php script:

<?php
$navBase = "../";
$altLang = "dir_s.php";
$actPage = 11;
require("../navbt/nav_eng.php");
?>

First the php variables "$navBase", "$altLang" and "$actPage" are set, and then the file "nav_eng.php" is included. This file is used on all pages, and contains information (URL and button image) about the links in the navbar.

nav_eng.php Click to see the code in that file (in the new window "newTestWin").


3:

Finally we have this php script:

<?php require("../navbt/nav_horz.php"); ?>

This includes the file "nav_horz.php", This file is used on all pages with a horizontal navbar, the script writes the navbar table.

nav_horz.php Click to see the code in that file (in the new window "newTestWin")

(There is another file, nav_vert.php, that is used on all pages with a vertical navbar.)


Page created 2001-07-22, last changed 2003-08-30 10:22
This mirror page last changed 2009-12-04

© 2003 Bo Johansson