WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Create dynamic navigation bars for a set of web pages.
Categories : HTML, PHP Update Picture
Dougal Campbell
Date : Jan 17th 1999
Grade : 2 of 5 (graded 5 times)
Viewed : 6448
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Dougal Campbell
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<?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
Parses HTTP_USER_AGENT so that you can customize your site to different browsers
Categories : HTML, PHP, Complete Programs
Popup Menu 0.5, popup, select, html, state-maintaing
Categories : HTML, PHP, HTML and PHP
Newbie Notes #10 - Generating drop downs
Categories : PHP, MySQL, HTML, Beginner Guides, Databases
FormWizard reads a mysql table and generates automatically a html formular in a html-table
Categories : PHP, MySQL, HTML
ANTI leech script, use this if you want that people can't see the original URL. The files can be on your own server or on another server.
Categories : HTML, Misc, PHP
Builds JavaScript that updates the contents of one selector based on another.
Categories : HTML, Java Script, PHP, Complete Programs, General
Allows you to parse a deliniated string and put the individual fields in a SELECT option in a form
Categories : HTML, PHP, Strings
How to know which input button of type image was pressed in a form with multiple image buttons (_x and _y) in PHP?
Categories : PHP, Variables, HTML
How to preset a text string in a textarea input field
Categories : HTML, HTML and PHP, PHP, Beginner Guides
How to use regular expressions to get the list of links from an HTML page
Categories : PHP, Regexps, HTML, HTML and PHP
BBCode Formatting String
Categories : PHP, HTML, Regexps, Arrays
Paginator - a class that can help you to split MySQL database query result sets to pages.
Categories : MySQL, Databases, HTML, PHP
Browser Detecor Class
Categories : PHP Classes, PHP, HTML
Real simple example of removing HTML tags from text then changing \n (new line) to <br>. Could be used in a forum for instance.
Categories : HTML, PHP, HTML and PHP, Beginner Guides