Hey all,
Most menus that are on web sites have no active link. You know, a way to visually see which page you are on. CSS included menus are usually all clickable, even if you are on that page. As anyone knows who uses either HTML or CSS, the active tag is not really active. It is just active when you are clicking it.
Ok enough of theory.
Here is a small php script that can be included on each page which you can design how you wish the 'active' link to be displayed.
I've used a copy for my footer on a site.PHP Code:<!-- footer menu include -->
<?php
echo "<div class='footer'>";
$page_loc = array(1=>'/index.php', '/hosting/index.php', '/design.php', '/contact.php');
$page_name = array(1=>'Home Page', 'Web Hosting', 'Web Design', 'Contact Form');
foreach( $page_loc as $key => $value ){
if( $_SERVER['PHP_SELF'] == $page_loc[$key] ){
echo ": $page_name[$key] :";
} else {
echo "<A HREF='$page_loc[$key]'>: $page_name[$key] :</A>";
}
}
echo "</div>";
?>
Quick explanation:
$page_loc is an array of your actual pages. Note that you can put references to pages off of the main public_html ( or what ever your main site is located ).
$page_name is the name that will appear in your menu.
By picking up $_SERVER['PHP_SELF'], it displays that link as a text link and not a hyperlink. All other menu items are displayed as hyperlinks.
Now, in your footer CSS file, you can define how you want the text, background colors, images etc. The colons ( : ) I put in are just for my site, they have no significance.
Have fun with it, let me know if there are any problems.
![]()



LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks