Welcome to WebmasterWorld Guest from 188.8.131.52
Forum Moderators: mack
Unfortunately I don't have an answer for you, but, I thought I'd keep the topic live. I too would like to know how to do this using the a:active element and css.
SSI menu needs to show "active" page [webmasterworld.com]
Giving button for the loaded page a unique background.
I am also using an include method for navigation and would like to have the active state of the css links to be active when visiting that page.
Instead of just different colours, you could have different pictures by using different backgounds e.g.
@willybfriendly your solution sounds the best to me so far. I no nothing about PHP so if you can just guide me through this I would highly appreciate it. A tutorial or something would be great a snippet would be ideal.
What I'm actually doing is redesigning the corporate website here and I thought this feature would become very useful as a visual aid in navigation. The site has about 200+ pages and I've set it up with library items in Dreamweaver MX so if I updated the library item it takes affect thought my whole site. The Library item is kept in comment tags so it doesn't generate extra code like FrontPage would.
I didn't mean the roll-overs... I assumed you already had that. I meant use CSS to highlight which is the 'current selection' as well as use it to have a roll-over effect for the other buttons in the menu.
PHP is a good solution as well, though my philosophy is to only use server-side processing for truly dynamic parts of a site. i.e. If it doesn't need to be database-driven, you should be able to distribute the site on a CD, without the need for a web-server.
willybfriendly might have a good suggestion for a php tutorial, and you can also browse around [webmasterworld.com...] and the perl/php forum, and use the site search facility at the top of the page.
I saw a link to a CSS crash course that sounds good.
By the way is PHP always a server scripting technology? (I am fully aware this might sound like a stupid question, but it comes with the territory)
if $title == "first anchor text"
echo "first anchor text";
else echo "<TD class=\"menu\"><a href=\"1stanchor.php\" class=\"menu\">>first anchor text</a><TD>";
if $title == "second anchor text"
echo "second anchor text";
else echo "<TD class=\"menu\"><a href=\"2ndanchor.php\" class=\"menu\">>second anchor text</a><TD>";
will create a horizontal menu bar that leaves the current page's link inactive. To use, on the page use
$title = current page title;
*put function here, or in an include*
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title><? echo $title;?></title>
<h1><? echo $title;?></H1>
Body of page....
Note that this places the page title in the title tag, an H1 tag, and displays the "custom" menu bar. And it can be used over and over and over... only changing the title of the page in one line.
PHP is well worth the time to learn at least the basics :)