Synchronize your Files - Free Animated Greetings - Properties in Dubai - Debt Consolidation - Debt Consolidation

PDA

View Full Version : constant Mouseover if page is being viewed


Silver89
Nov 13th 2006, 3:22 am
Ok, i have a site funzac.com/sitec which is for a school project.

I need the links at the top to have the css mouseover applied if it is on that current page.

To do this i figured i would need to get the url with php and then have something in the link style to tell it if 1 do and if 0 display normal.

this is as far as i got before i completly mind blanked

<?php
$url = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
?>
<div class="header">
<a href="index.php"><img class="image" src="images/homepage.png" width="500" height="80"/></a>
<div class="navigation">

<a style="<? if{$url == href ?>" href="index.php">Home</a>
<a href="about.php">About</a>
<a href="contact.php">Contact</a>
<a href="hours.php">Hours</a>
<a href="location.php">Location</a>
<a href="services.php">Services</a>

</div>
</div>

mad4
Nov 13th 2006, 3:33 am
$php_self will output the file name so you would use

if($php_self=="index.php"){
// do something
}

Silver89
Nov 13th 2006, 3:45 am
This is what i now have:

<a style="<? if($php_self=="./"){echo"border-bottom: 3px solid #FFFFFF;color: #FFFFFF;";}?>" href="index.php">Home</a>

It only works if i put else and then put the same code but then it doesnt turn off.

SO basically the =="./" is wrong. I need it to be if php_self = current page i think.

Silver89
Nov 13th 2006, 4:19 am
done with the following

<?php $url = $_SERVER['PHP_SELF'];?>
<div class="header">
<a href="index.php"><img class="image" src="images/homepage.png" width="500" height="80"/></a>
<div class="navigation">

<a style="<? if($url=="/sitec/index.php"){echo"border-bottom: 3px solid #FFFFFF;color: #FFFFFF;";}?>" href="index.php">Home</a>
<a style="<? if($url=="/sitec/about.php"){echo"border-bottom: 3px solid #FFFFFF;color: #FFFFFF;";}?>" href="about.php">About</a>
<a style="<? if($url=="/sitec/contact.php"){echo"border-bottom: 3px solid #FFFFFF;color: #FFFFFF;";}?>" href="contact.php">Contact</a>
<a style="<? if($url=="/sitec/hours.php"){echo"border-bottom: 3px solid #FFFFFF;color: #FFFFFF;";}?>" href="hours.php">Hours</a>
<a style="<? if($url=="/sitec/location.php"){echo"border-bottom: 3px solid #FFFFFF;color: #FFFFFF;";}?>" href="location.php">Location</a>
<a style="<? if($url=="/sitec/services.php"){echo"border-bottom: 3px solid #FFFFFF;color: #FFFFFF;";}?>" href="services.php">Services</a>

</div>
</div>