WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
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 Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
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
Forex Trading Online forex trading platform

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 : Prints a bar of links to each HTML page it finds in the current directory, using the <TITLE> tag for the name of each link
Categories : HTML, Filesystem, PHP Update Picture
Rob Fisher
Date : Jan 17th 1999
Grade : 1 of 5 (graded 1 times)
Viewed : 3852
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Rob Fisher
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<?php

/* Menu Bar v.1.0 by Rob Fisher
24 August 1998

This script is designed to be included in a file. Every time
it is called, it scans the parent file's directory for other
html/phtml pages and prints a bar of links to those pages. The
displayed name of the link is taken from that page's <TITLE>
tag. If no such tag is found, then the link is not printed.

The first and last elements in the bar are default links,
perhaps to the top of your document tree and the top of
the current area. The second element, titled "up" just links
to the parent directory.

I use this script in our internal pages, and it works nicely
and safely for me, though I can't guarantee absolutely that
you'll be so lucky. Feel free to hack it about however you
like.

Have fun, and feel free to contact me at r.d.fisher@hud.ac.uk
*/

/* First, create a function to print the links themselves. This
makes it easy to change the look of the whole bar in one go.

If you want to display the bar more than once in a single page,
you'll have to move echo_link() out of this file or you'll get
an error for trying to declare the same function twice. */

function echo_link($col, $link, $text) {
echo "<TD BGCOLOR=\"$col\" ALIGN=CENTER VALIGN=MIDDLE>\r";
echo "<A ";

/* by default, inline style is used to print the links in
a small, white, sans-serif font with no underline */

echo "STYLE=\"text-decoration: none; font-weight: bold; ";
echo "font-family: ariel, helvetica, sans-serif; ";
echo "color: #FFFFFF; font-size: small\" ";

echo "HREF=\"$link\">$text</A></SMALL></TD>\r";
}

// Okay, let's open the TABLE and print the first default link

echo "<TABLE WIDTH=\"100%\"><TR>\r";
echo_link("#114711", "/index.phtml", "home");

// Now, the "up" link

echo_link("#111146", "../", "up");

/* If you're including this script from a function, you'll need
to make $SCRIPT_FILENAME a global variable. */

if (!$SCRIPT_FILENAME)
global $SCRIPT_FILENAME;

// We'll have to loop through all the files in the current directory

$d = dir(dirname($SCRIPT_FILENAME));
while($file=$d->read()):

/* we don't want this file or any directories, but we do want all
.html and .phtml files */

if (($file != basename($SCRIPT_FILENAME)) && (is_file($file))
&& eregi("html$", $file)):
$fp = fopen("$file", "r");

$build = "";
$flag = 0;

for ($i = 0; !feof($fp); $i++) {
$line = fgets($fp, 1024);

/* The <TITLE> tag MUST be opened at the
beginning of a new line */

if (ereg("^<TITLE>", $line))
$flag = 1;

if ($flag == 1)
$build = $build.$line;

if (ereg("</TITLE>", $line))
$flag = 0;
}

if ($build > ""):
$build = ereg_replace("<TITLE>", "", $build);
$build = ereg_replace("</TITLE>", "", $build);
$build = trim($build);
echo_link("#111111", $file, $build);
endif;
endif;

endwhile;

// To finish off the bar, the other fixed link

echo_link("#114711", "/intranet/index.phtml", "intranet");
echo "</TR></TABLE>";

// and finally, close the directory

$d->close();
?>



Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel
Take multiple text files and do simple formatting on them and add them to a webpage
Categories : HTML, Filesystem, PHP
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
Random Image Display
Categories : PHP, Filesystem, Graphics, HTML and PHP
PHP based Contact email form with multiple recipients, text file based, supports departments.
Categories : PHP, Email, Beginner Guides, Filesystem
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
The toll booth
Categories : PHP, Java Script, Filesystem
php jump urls...the best way
Categories : PHP, URLs, Filesystem
Simple way to replace a variable value in a .conf (.ini) file using a webbrowser - the first stage of a complete universal configuration editor
Categories : PHP, Regexps, Code Editors, Filesystem
Display list of files within current and subdirectories (recursively) showing each file as an anchored link and each directory as a category header.
Categories : Filesystem, Directories, Arrays, PHP
File Explorer, browse, upload, download and edit your web site files with only a browser and a HTTP connection.
Categories : Complete Programs, Content Management, Filesystem, PHP
GuestBook Light - a plug and play application for any website.
Categories : PHP, Complete Programs, Filesystem, Sessions
Browser Detecor Class
Categories : PHP Classes, PHP, HTML
 Madmethod wrote :95
to the author/anyone who downloads this, it may be a 
good idea to make all those ereg`s into eregi`s and 
ereg_replace into eregi_replace, that kinda got me when i 
tried to get it working, all my pages had &lt;title&gt; instead of 
&lt;TITLE&gt;
:)