|
|
|
<?php
/*
* navbar.php3 -- Version 1.0, 98/07/24
*
* Dougal Campbell <dougal@gunters.org>
* http://www.gunters.org/~dougal/
*
* Provides a common navigation bar to a set of pages, dynamically
* making sure that the link to the current page isn't hyperlinked.
*
* Usage:
* In each file which will display the navigation bar:
* <?php include "navbar.php3"; ?>
*
* Edit $links_arr to contain the name of the link and the
* URL for link (can be relative or absolute URL).
*
* TODO:
* o Read array from a flat text file
* o Read array from database
* o Support for graphical buttons instead of just text
* o Support for frame targets
*
*/
/* User configurable variables */
$links_arr = array(
"Test Page 1" => "/~dougal/test1.phtml",
"Test Page 2" => "/~dougal/test2.phtml",
"Test Page 3" => "/~dougal/test3.phtml"
);
$separator = " | "; /* Put a vertical bar between links */
/* Main code begins here */
/* Step through the array.... */
for (reset($links_arr); $name = key($links_arr); next($links_arr)) {
$hyper = 1; /* Hyperlink on by default */
/*
* If the current page URI matches the current array element,
* don't add the <A HREF....> stuff. Use the $hyper var to flag it.
*/
if ($REQUEST_URI == $links_arr[$name]) {
$hyper = 0; /* Don't hyperlink a page to itself */
}
/* Conditionally do the <A HREF...> part for hyperlinks */
if ($hyper) {
print "<A HREF=\"" . $links_arr[$name] . "\">";
}
print $name; /* Print the name of the link */
if ($hyper) { print "</A>"; } /* Close the hyperlink */
/* Do fancy tricks to print separators between links
* The next/prev stuff keeps it from putting a trailing '|'
* at the end of the list by testing to see if we are currently
* looking at the last element of the $links_arr array.
*/
if (next($links_arr)) { print $separator; prev($links_arr); }
}
?>
|
|
| Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | color codes for positive and negative numbers Categories : PHP, MySQL, Databases, HTML | | | Parses HTTP_USER_AGENT so that you can customize your site to different browsers Categories : HTML, PHP, Complete Programs | | | FormWizard reads a mysql table and generates automatically
a html formular in a html-table Categories : PHP, MySQL, HTML | | | Allows you to parse a deliniated string and put the individual fields in a SELECT option in a form Categories : HTML, PHP, Strings | | | Browser Detecor Class Categories : PHP Classes, PHP, HTML | | | Display Slashdot headers on your own site Categories : HTML and PHP, HTML, PHP | | | webcam cam view image ispy browser independant Categories : Graphics, HTML, HTML and PHP, PHP | | | Builds JavaScript that updates the contents of one selector based on another. Categories : HTML, Java Script, PHP, Complete Programs, General | | | ASCII To HTML Converter Categories : PHP, HTML, ASCII | | | How to preset a text string in a textarea input field Categories : HTML, HTML and PHP, PHP, Beginner Guides | | | Automatic generation of HTML code for a table. OO interface. Can define colspan, rowspan, table style, cell style, and data style. Simple, but
effective. Categories : PHP, PHP Classes, HTML, HTML and PHP | | | This script shows you the 7th latest php items from the mailing list archive on zend.com Categories : HTML, HTML and PHP, HTTP, PHP | | | The first step Guest Book ... ^^ Categories : MySQL, PHP, Apache, HTML, HTTP | | | GonxTabs : Create elegant HTML tabs based interface Categories : Navigation, HTML, HTML and PHP, PHP | |
|
|
|