Forum Moderators: coopster
Thanks in advance for the help. Hope it made sense. :)
Wes
the name of the page can be seen in the PHP's environment variable $_SERVER["PHP_SELF"].
So you may try and put a
(if $_SERVER["PHP_SELF"] == "/about.php") {
echo "this is the about page";
}
else {
echo "this is not the about page";
}
right in your topnav.php to know what page you are on and did the include.
HTH and regards,
R.
Please be gentle..it's not an example of advanced scripting :) just something I cooked up in a pinch.
Is just calls the mouseover function that comes with Dreamweaver. I kinda hate it, but keep using it on all kinds of sites...I think I'm a masochist
function SetMouseOver(){
for(i=0;i<document.images.length;i++){
//If the link attached to the image matches the current document location..
if (document.images[i].parentElement == document.location.href){
CurImg = document.images[i].name
FullImagePath = new Array();
ImageName = new Array();
//Get the image name in an array
FullImageName = document.images[i].src.split("/");
ImageName = FullImageName.pop(); //Put the last element in ImageaName and modify FullImageName
RealImagePath = FullImageName.join("/"); //Now..put the slashes back in the image path
ImageName = ImageName.split(".");
JustImageName = RealImagePath+'/'+ImageName[0];
ImageExtension = ImageName[1];
MM_swapImage(document.images[i].name,'',JustImageName+'Over.'+ImageExtension,1);
//alert(RealImagePath+' '+JustImageName+' '+ImageExtension)
}
}
}
HTH
Bill
<?php
$tab = basename($_SERVER['PHP_SELF'], ".php");
$body_attributes = '';
if ($tab) $body_attributes = "class=\"$tab\"";
?>
<body<?php if ($body_attributes) print " $body_attributes";?>>
<div id="topnav">
<a href="tab1.php" id="tab1" title="Tab1">tab1</a>
<b>¦</b><a href="tab2.php" id="tab2" title="Tab2">tab2</a>
<b>¦</b><a href="tab3.php" id="tab3" title="Tab3">tab3</a>
<b>¦</b><a href="tab4.php" id="tab4" title="Tab4">tab4</a>
</div>
<style>
body {background-color: #CCC; }
#topnav a:hover, #topnav a:active {background-color: #603; color: #FFC; }
.tab1 #topnav #tab1 {color: #FFC; background: transparent;}
.tab2 a#tab2, .tab3 a#tab3, .tab4 a#tab4 {color: #FFC; background: transparent;}
</style>
<?php
if ($_SERVER["PHP_SELF"]== "index.php") {
?>
<a href="index.php"><img src="images/home-over.gif" alt="index.php" width="49" height="23" border="0"></a>
<?php
} else {
?>
<a href="index.php"><img src="images/home.gif" alt="index.php" width="49" height="23" border="0"></a>
<?php
}
?>