using the TITLE tag for the name of each link
/* 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 "\r"; echo " /* 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 | \r";
}
// Okay, let's open the TABLE and print the first default link
echo "\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 tag MUST be opened at the
beginning of a new line */
if (ereg("^", $line))
$flag = 1;
if ($flag == 1)
$build = $build.$line;
if (ereg("", $line))
$flag = 0;
}
if ($build > ""):
$build = ereg_replace("", "", $build);
$build = ereg_replace("", "", $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 "
";
// and finally, close the directory
$d->close();
?>