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 : 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 : 4925
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  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
The first step Guest Book ... ^^
Categories : MySQL, PHP, Apache, HTML, HTTP
Parses HTTP_USER_AGENT so that you can customize your site to different browsers
Categories : HTML, PHP, Complete Programs
Relative Path
Categories : PHP, Filesystem
BBCode Formatting String
Categories : PHP, HTML, Regexps, Arrays
A File Browser Class.To Read Drives,Directories and Files .Files writing is also possible
Categories : PHP, PHP Classes, Filesystem
Link Submition - Allow your visitors to submit links to the site.
Categories : PHP, Arrays, Filesystem, Beginner Guides
directory, opendir, listfiles, files in a directory, get directory
Categories : PHP, Filesystem
getDirArray(Path,Filter,Sorted): Returns an array of the files in a directory, filtered by regular expression and either sorted or randomized. Good for random pictures and graphics.
Categories : PHP, Filesystem, Directories
Paginator - a class that can help you to split MySQL database query result sets to pages.
Categories : MySQL, Databases, HTML, PHP
Remote Archive (Zip, Tar, Gzip) downloader with FTP and local extration support
Categories : PHP, FTP, Filesystem, PHP Classes, Compression
Listing the 10 most recently updated files in a given dir by using last- modified variable and printing to html with link to the file
Categories : PHP, Directories, Filesystem
filesplit : Split big text files in multiple small ones
Categories : PHP, Log Files, Filesystem, PHP Classes
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
 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;
:)