OZONE Asylum
Forums
Server-Side Scripting - Oh my!
Quick Question for a dymanic navigation using PHP
This page's ID:
31516
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Hey guys, This is usually my last resort when I get stuck on a problem and here I am, yet again, stuck. I'm trying to use php to indicate the current page you are on by having a tab with white text while all others have blue. I was thinking a simple if else type statement would work but I think I'm getting the syntax all wrong. <div id="nav"> [i]<?php $currentPage = basename($_SERVER['SCRIPT_NAME']); ?> <a href="<img src="img/home_on.jpg" alt="Home" /> <a href="articles.php"> <?php if ($currentPage == 'index.php') {echo '<img src="img/articles_on.jpg"';} ?> <img src="img/articles_off.jpg" class="domroll img/articles_on.jpg" alt="Articles" /></a> [/i] The logic seems simple enough to me. If $currentPage == 'index.php" then echo the on image. How do i impliment an else (display the off image)? Does this make any sense? I'm sure there are a ton of easier ways to do this, one of which is not use images for the navigation. [i] <img src="img/gallery_off.jpg" class="domroll img/gallery_on.jpg" alt="Gallery" /> <img src="img/directory_off.jpg" class="domroll img/directory_on.jpg" alt="Directory" /> <img src="img/churches_off.jpg" class="domroll img/churches_on.jpg" alt="Churches" /> <img src="img/contact_off.jpg" class="domroll img/contact_on.jpg alt="Contact" /></div> <div id="mainpic"></div>[/i] Thanks! [img]http://www.wayoutwestenterprises.com/images/rob_sp_sig.gif[/img]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »
Maximum Security
OZONE
DHTML/Javascript
Server-Side Scripting - Oh my!
CSS - DOM - XHTML - XML - XSL - XSLT
Stupid Basic HTML
Visual Therapy
Photoshop
Photoshop Pong, Anyone?
***WARNING*** BIG SIG APPROACHING
Photography
3D Modelling & Rendering
Multimedia/Animation
Print Graphics
Holding Pens
Philosophy and other Silliness
Outpatient Counseling
Site reviews!
Mad Scientists' Laboratory
Getting to know the Grail