im terrible at titles.. sorry.
im starting to implement a includes'mypage.php' footer in some pages so i can make changes easily to one file.. great.. my qustion is.. i use to use a different style on the link of the page i was currently on...

so if i had info/contact us/store/season and i was on the SEASON page, it would be a different style, to indicate the page that was currently being viewed

how can i achieve this with a footer that is generic for all pages now, that is injected?

thanks
pj

<?php 
$thisfile = substr($_SERVER['REQUEST_URI'], strrpos($_SERVER['REQUEST_URI'], '/') + 1);
if ($thisfile == 'index.php') { echo 'Home'; } else{ echo '<a href="index.php">Home</a>'; }
if ($thisfile == 'one.php') { echo 'menu1'; } else{ echo '<a href="one.php">menu1</a>'; }
if ($thisfile == 'two.php') { echo 'menu2'; } else{ echo '<a href="two.php">menu</a>'; }
/*  etc  */
?>

just one possibility of many

commented: man, its not me being lazy, i am really trying on my own, finally, when i give up hope, i come here and post, and BOOM almostbob helps out everytime! very quick, very helpful, i am very gratefull! it is so nice of him to give his time to help me! pj +2

this is perfect, exactly what i was looking for. thanks again!
pj

running into a snag... i have most of the pages in public_html/
no problem then.. but i have a couple in sub directories...
i cannot get it to show current page when in sub dir...

index.php
history.php
all fine...

but when i have
giftshop/index.php

i cannot get it to show im on this page..
i have tried saying

$thisfile == "/giftshop/index.php"
ive tried
$thisfile == "http://domain.com/giftshop/index.php"

cant get it to show current page.. whats the trick??
thanks again!
pj

thescript breaks the url at the first slash after the domain name $thisfile=='giftshop/index.php' should work

,,Ancora Imparo,, (I am still learning)

its not though...

i have tried:
"domain.com/giftshop/index.php"
"http://domain.com/giftshop/index.php"
"http://www.domain.com/giftshop/index.php"
"giftshop/index.php"
"/giftshop/index.php"
"giftshop/"
"/giftshop/"
"/giftshop"

i echoed

$_SERVER['REQUEST_URI']

on the giftshop/index.php page
and it printed

/giftshop/index.php

so i copied it exactly, and pasted it...

f ($thisfile == 'giftshop/index.php') { echo ' Giftshop | '; } else{ echo '<a class="nav" href="http://domain.com/giftshop/index.php">Giftshop</a> | '; }

but no luck... still shows as a link

thanks
pj

bum
not learning quickly enough, going back to look again

Reading what you wrote

/giftshop/index.php/giftshop/index.php
so i copied it exactly, and pasted it...

f ($thisfile == 'giftshop/index.php') { echo ' Giftshop | '; } else{ echo '<a class="nav" href="http://domain.com/giftshop/index.php">Giftshop</a> | '; }f ($thisfile == 'giftshop/index.php') { echo ' Giftshop | '; } else{ echo '<a class="nav" href="http://domain.com/giftshop/index.php">Giftshop</a> | '; }

maybe there should be a leading slash
still thinkning, I cant make the damn thing fail ?? so dunno whats wrong

ohh, i forget to mention...
i have all the links in a file bottom_nav.php that is called (included) in each page...
it is loading fine, because i can see everything, only the word giftshop is still a link...
the bottom_nav.php resides in public_html, and is being called from within giftshop/index.php
ill try putting the code directly inside the file, and see how that goes..
i really dont want to do it that way though, i want one footer bottom_nav.php that i edit only once for all files, that was the point of all this...
thanks again for all your help!
pj

Member Avatar

diafol

why not use something like:

include($_SERVER['DOCUMENT_ROOT'] . "/giftshop/index.php");

It's not pretty, but should work for remote sites. If your localhost url is something like:

http://localhost/mysite/giftshop/index.php

This won't work for your localhost. If this is the case look at changing your hosts and httpd-vhosts.conf files.

ok, now im looking at a way to have a chunk of code change based on which site one is currently on...
can i use the above code?

<?php 
$thisfile = substr($_SERVER['REQUEST_URI'], strrpos($_SERVER['REQUEST_URI'], '/') + 1);
if ($thisfile == 'index.php') { echo 'Home'; } else{ echo '<a href="index.php">Home</a>'; }
if ($thisfile == 'one.php') { echo 'menu1'; } else{ echo '<a href="one.php">menu1</a>'; }
if ($thisfile == 'two.php') { echo 'menu2'; } else{ echo '<a href="two.php">menu</a>'; }
/*  etc  */
?>

and just leave empty the ones im not using?

i have a menu bar on the right side, i would like to inlude this in my side-bar_nav.php file.. but if i am at HISTORY.. i want the graphic to change to indicate i am at HISTORY (it is currently like this, but each page has its own html pode.. in other words, i have done it manually

that and i have a main index poster.jpg that changes regarding which page i am currently on

thanks again everyone
pj

Member Avatar

diafol

How about changing

substr($_SERVER['REQUEST_URI'], strrpos($_SERVER['REQUEST_URI'], '/') + 1)

to

basename($_SERVER['PHP_SELF'])

thanks ardav..
i made the changes to my footer file.. and all is well
now im trying to impletment it with the graphics...
something tells me this is terribly wrong, looks very redundant

<?php 
$thisfile = basename($_SERVER['PHP_SELF']);
if ($thisfile == 'information.php') { echo '<!-- ImageReady Slices (menu) -->
<br>
<br>
<TABLE WIDTH=142 BORDER=0 CELLPADDING=0 CELLSPACING=0>
	<TR>
		<TD>
			<IMG SRC="images/new_menu_01.gif" WIDTH=142 HEIGHT=33 ALT=""></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/season.php"
				ONMOUSEOVER="changeImages('season', 'images/season-over.gif'); return true;"
				ONMOUSEOUT="changeImages('season', 'images/season.gif'); return true;">
				<IMG NAME="season" SRC="images/season.gif" WIDTH=142 HEIGHT=29 BORDER=0 ALT="Season and Hours"></A></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/rooms.php"
				ONMOUSEOVER="changeImages('rooms', 'images/rooms-over.gif'); return true;"
				ONMOUSEOUT="changeImages('rooms', 'images/rooms.gif'); return true;">
				<IMG NAME="rooms" SRC="images/rooms.gif" WIDTH=142 HEIGHT=27 BORDER=0 ALT="Rooms and Rates"></A></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/dining.php"
				ONMOUSEOVER="changeImages('dining', 'images/dining-over.gif', 'history', 'images/history-dining_over.gif'); return true;"
				ONMOUSEOUT="changeImages('dining', 'images/dining.gif', 'history', 'images/history.gif'); return true;">
				<IMG NAME="dining" SRC="images/dining.gif" WIDTH=142 HEIGHT=20 BORDER=0 ALT="Dining and Menu"></A></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/history.php"
				ONMOUSEOVER="changeImages('history', 'images/history-over.gif'); return true;"
				ONMOUSEOUT="changeImages('history', 'images/history.gif'); return true;">
				<IMG NAME="history" SRC="images/history.gif" WIDTH=142 HEIGHT=23 BORDER=0 ALT="History"></A></TD>
	</TR>
	<TR>
		<TD>
				<IMG src="images/information-over.gif" WIDTH=142 HEIGHT=23 BORDER=0 ALT="Information"></TD>
	</TR>
	<TR>
		<TD>			<img src="images/new_menu_07.gif" width="142" height="34"></TD>
	</TR>
</TABLE>
<!-- End ImageReady Slices -->'; } else{ echo ''; } 
if ($thisfile == 'rooms.php') { echo ' <TABLE WIDTH=142 BORDER=0 CELLPADDING=0 CELLSPACING=0>
	<TR>
		<TD>
			<IMG SRC="images/new_menu_01.gif" WIDTH=142 HEIGHT=33 ALT=""></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/season.php"
				ONMOUSEOVER="changeImages('season', 'images/season-over.gif'); return true;"
				ONMOUSEOUT="changeImages('season', 'images/season.gif'); return true;">
				<IMG NAME="season" SRC="images/season.gif" WIDTH=142 HEIGHT=29 BORDER=0 ALT="Season and Hours"></A></TD>
	</TR>
	<TR>
		<TD>
				<IMG SRC="images/rooms-over.gif" WIDTH=142 HEIGHT=27 BORDER=0 ALT="Rooms and Rates"></A></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/dining.php"
				ONMOUSEOVER="changeImages('dining', 'images/dining-over.gif', 'history', 'images/history-dining_over.gif'); return true;"
				ONMOUSEOUT="changeImages('dining', 'images/dining.gif', 'history', 'images/history.gif'); return true;">
				<IMG NAME="dining" SRC="images/dining.gif" WIDTH=142 HEIGHT=20 BORDER=0 ALT="Dining and Menu"></A></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/history.php"
				ONMOUSEOVER="changeImages('history', 'images/history-over.gif'); return true;"
				ONMOUSEOUT="changeImages('history', 'images/history.gif'); return true;">
				<IMG NAME="history" SRC="images/history.gif" WIDTH=142 HEIGHT=23 BORDER=0 ALT="History"></A></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/information.php"
				ONMOUSEOVER="changeImages('information', 'images/information-over.gif'); return true;"
				ONMOUSEOUT="changeImages('information', 'images/information.gif'); return true;">
				<IMG NAME="information" src="images/information.gif" WIDTH=142 HEIGHT=23 BORDER=0 ALT="Information"></A></TD>
	</TR>
	<TR>
		<TD>			<img src="images/new_menu_07.gif" width="142" height="34"></TD>
	</TR>
</TABLE>
<!-- End ImageReady Slices -->'; } else{ echo ''; } 
if ($thisfile == 'dining.php') { echo ' <!-- ImageReady Slices (menu) -->
<br>
<br>
<TABLE WIDTH=142 BORDER=0 CELLPADDING=0 CELLSPACING=0>
	<TR>
		<TD>
			<IMG SRC="images/new_menu_01.gif" WIDTH=142 HEIGHT=33 ALT=""></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/season.php"
				ONMOUSEOVER="changeImages('season', 'images/season-over.gif'); return true;"
				ONMOUSEOUT="changeImages('season', 'images/season.gif'); return true;">
				<IMG NAME="season" SRC="images/season.gif" WIDTH=142 HEIGHT=29 BORDER=0 ALT="Season and Hours"></A></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/rooms.php"
				ONMOUSEOVER="changeImages('rooms', 'images/rooms-over.gif'); return true;"
				ONMOUSEOUT="changeImages('rooms', 'images/rooms.gif'); return true;">
				<IMG NAME="rooms" SRC="images/rooms.gif" WIDTH=142 HEIGHT=27 BORDER=0 ALT="Rooms and Rates"></A></TD>
	</TR>
	<TR>
		<TD>
				<IMG SRC="images/dining-over.gif" WIDTH=142 HEIGHT=20 BORDER=0 ALT="Dining and Menu"></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/history.php"
				ONMOUSEOVER="changeImages('history', 'images/history-over.gif'); return true;"
				ONMOUSEOUT="changeImages('history', 'images/history.gif'); return true;">
				<IMG NAME="history" SRC="images/history.gif" WIDTH=142 HEIGHT=23 BORDER=0 ALT="History"></A></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/information.php"
				ONMOUSEOVER="changeImages('information', 'images/information-over.gif'); return true;"
				ONMOUSEOUT="changeImages('information', 'images/information.gif'); return true;">
				<IMG NAME="information" src="images/information.gif" WIDTH=142 HEIGHT=23 BORDER=0 ALT="Information"></A></TD>
	</TR>
	<TR>
		<TD>			<img src="images/new_menu_07.gif" width="142" height="34"></TD>
	</TR>
</TABLE>
<!-- End ImageReady Slices -->'; } else{ echo ''; } 
if ($thisfile == 'season.php') { echo ' <!-- ImageReady Slices (menu) -->
<br>
<br>
<TABLE WIDTH=142 BORDER=0 CELLPADDING=0 CELLSPACING=0>
	<TR>
		<TD>
			<IMG SRC="images/new_menu_01.gif" WIDTH=142 HEIGHT=33 ALT=""></TD>
	</TR>
	<TR>
		<TD>
<IMG SRC="images/season-over.gif" WIDTH=142 HEIGHT=29 BORDER=0 ALT="Season and Hours"></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/rooms.php"
				ONMOUSEOVER="changeImages('rooms', 'images/rooms-over.gif'); return true;"
				ONMOUSEOUT="changeImages('rooms', 'images/rooms.gif'); return true;">
				<IMG NAME="rooms" SRC="images/rooms.gif" WIDTH=142 HEIGHT=27 BORDER=0 ALT="Rooms and Rates"></A></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/dining.php"
				ONMOUSEOVER="changeImages('dining', 'images/dining-over.gif', 'history', 'images/history-dining_over.gif'); return true;"
				ONMOUSEOUT="changeImages('dining', 'images/dining.gif', 'history', 'images/history.gif'); return true;">
				<IMG NAME="dining" SRC="images/dining.gif" WIDTH=142 HEIGHT=20 BORDER=0 ALT="Dining and Menu"></A></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/history.php"
				ONMOUSEOVER="changeImages('history', 'images/history-over.gif'); return true;"
				ONMOUSEOUT="changeImages('history', 'images/history.gif'); return true;">
				<IMG NAME="history" SRC="images/history.gif" WIDTH=142 HEIGHT=23 BORDER=0 ALT="History"></A></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/information.php"
				ONMOUSEOVER="changeImages('information', 'images/information-over.gif'); return true;"
				ONMOUSEOUT="changeImages('information', 'images/information.gif'); return true;">
				<IMG NAME="information" src="images/information.gif" WIDTH=142 HEIGHT=23 BORDER=0 ALT="Information"></A></TD>
	</TR>
	<TR>
		<TD>			<img src="images/new_menu_07.gif" width="142" height="34"></TD>
	</TR>
</TABLE>
<!-- End ImageReady Slices -->'; } else{ echo ''; } 
if ($thisfile == 'history.php') { echo ' <!-- ImageReady Slices (menu) -->
<br>
<br>
<TABLE WIDTH=142 BORDER=0 CELLPADDING=0 CELLSPACING=0>
	<TR>
		<TD>
			<IMG SRC="images/new_menu_01.gif" WIDTH=142 HEIGHT=33 ALT=""></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/season.php"
				ONMOUSEOVER="changeImages('season', 'images/season-over.gif'); return true;"
				ONMOUSEOUT="changeImages('season', 'images/season.gif'); return true;">
				<IMG NAME="season" SRC="images/season.gif" WIDTH=142 HEIGHT=29 BORDER=0 ALT="Season and Hours"></A></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/rooms.php"
				ONMOUSEOVER="changeImages('rooms', 'images/rooms-over.gif'); return true;"
				ONMOUSEOUT="changeImages('rooms', 'images/rooms.gif'); return true;">
				<IMG NAME="rooms" SRC="images/rooms.gif" WIDTH=142 HEIGHT=27 BORDER=0 ALT="Rooms and Rates"></A></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/dining.php"
				ONMOUSEOVER="changeImages('dining', 'images/dining-over.gif', 'history', 'images/history-dining_over.gif'); return true;"
				ONMOUSEOUT="changeImages('dining', 'images/dining.gif', 'history', 'images/history.gif'); return true;">
				<IMG NAME="dining" SRC="images/dining.gif" WIDTH=142 HEIGHT=20 BORDER=0 ALT="Dining and Menu"></A></TD>
	</TR>
	<TR>
		<TD>
				<IMG SRC="images/history-over.gif" WIDTH=142 HEIGHT=23 BORDER=0 ALT="History"></TD>
	</TR>
	<TR>
		<TD>
			<A HREF="http://naniboujou.com/information.php"
				ONMOUSEOVER="changeImages('information', 'images/information-over.gif'); return true;"
				ONMOUSEOUT="changeImages('information', 'images/information.gif'); return true;">
				<IMG NAME="information" src="images/information.gif" WIDTH=142 HEIGHT=23 BORDER=0 ALT="Information"></A></TD>
	</TR>
	<TR>
		<TD>			<img src="images/new_menu_07.gif" width="142" height="34"></TD>
	</TR>
</TABLE>
<!-- End ImageReady Slices -->'; } else{ echo ''; }
/*  etc  */
?>

its a menu that changes graphic on page you are currently on by adding a drop shadow..
i am getting an error when trying to INCLUDE the menu tab in the pages..
thanks
pj

this on the other hand is working great

<?php 
$thisfile = basename($_SERVER['PHP_SELF']);
if ($thisfile == 'index_TEST.php') { echo '<img src="images/index_poster.jpg" width="560" height="280">'; } else{ echo ' '; } 
if ($thisfile == 'information.php') { echo '<img src="images/information_poster3.jpg" width="559" height="240">'; } else{ echo ' '; } 
if ($thisfile == 'rooms.php') { echo ' <img src="images/idea-for-rooms-poster.jpg" width="560" height="220" border="0">'; } else{ echo ' '; } 
if ($thisfile == 'dining.php') { echo '<img src="images/dining_poster.jpg" width="560" height="260">'; } else{ echo ' '; } 
if ($thisfile == 'season.php') { echo ' <img src="images/season_poster.jpg" width="560" height="260">'; } else{ echo ' '; } 
if ($thisfile == 'giftshop.php') { echo '<img src="images/giftshop_poster.jpg" width="560" height="215" border="0">'; } else{ echo ' '; }
if ($thisfile == 'history.php') { echo 'img src="images/history_poster.jpg" width="560" height="280"> '; } else{ echo ' '; }
if ($thisfile == 'retreat.php.php') { echo '<img src="images/anniversary_poster.jpg" width="559" height="200">'; } else{ echo ' '; }
if ($thisfile == 'photos.php') { echo '<img src="images/photo_poster.jpg" width="559" height="215" border="0">'; } else{ echo ' '; }
if ($thisfile == 'contact_us.php') { echo '<img src="images/contact_us_poster.jpg" width="560" height="245" border="0">'; } else{ echo ' '; }
/*  etc  */
?>

ok, duh, i see how redundant that was... and came up with:

<?php 
$thisfile = basename($_SERVER['PHP_SELF']);
<TABLE WIDTH=142 BORDER=0 CELLPADDING=0 CELLSPACING=0>
	<TR>
		<TD>
			<IMG SRC="images/new_menu_01.gif" WIDTH=142 HEIGHT=33 ALT=""></TD>
	</TR>
	<TR>
		<TD>
		if ($thisfile == 'season.php') { echo ' <IMG NAME="season" SRC="images/season-over.gif" WIDTH=142 HEIGHT=29 BORDER=0 ALT="Season and Hours"></A>'; } else{ echo '<IMG NAME="season" SRC="images/season.gif" WIDTH=142 HEIGHT=29 BORDER=0 ALT="Season and Hours"></A>'; } 
			<A HREF="http://naniboujou.com/season.php"
				ONMOUSEOVER="changeImages('season', 'images/season-over.gif'); return true;"
				ONMOUSEOUT="changeImages('season', 'images/season.gif'); return true;">
				</TD>
	</TR>
	<TR>
		<TD>
				if ($thisfile == 'rooms.php') { echo ' <IMG NAME="season" SRC="images/rooms-over.gif" WIDTH=142 HEIGHT=27 BORDER=0 ALT="rooms and rates"></A>'; } else{ echo '<IMG NAME="season" SRC="images/rooms.gif" WIDTH=142 HEIGHT=27 BORDER=0 ALT="Season and Hours"></A>'; } 
			<A HREF="http://naniboujou.com/rooms.php"
				ONMOUSEOVER="changeImages('rooms', 'images/rooms-over.gif'); return true;"
				ONMOUSEOUT="changeImages('rooms', 'images/rooms.gif'); return true;">
</TD>
	</TR>
	<TR>
		<TD>
				if ($thisfile == 'dining.php') { echo ' <IMG NAME="season" SRC="images/dining-over.gif" WIDTH=142 HEIGHT=20 BORDER=0 ALT="dining and menus"></A>'; } else{ echo '<IMG NAME="season" SRC="images/dining.gif" WIDTH=142 HEIGHT=20 BORDER=0 ALT="Season and Hours"></A>'; } 
			<A HREF="http://naniboujou.com/dining.php"
				ONMOUSEOVER="changeImages('dining', 'images/dining-over.gif', 'history', 'images/history-dining_over.gif'); return true;"
				ONMOUSEOUT="changeImages('dining', 'images/dining.gif', 'history', 'images/history.gif'); return true;">
</TD>
	</TR>
	<TR>
		<TD>
				if ($thisfile == 'history.php') { echo ' <IMG NAME="season" SRC="images/history-over.gif" WIDTH=142 HEIGHT=23 BORDER=0 ALT="Season and Hours"></A>'; } else{ echo '<IMG NAME="season" SRC="images/history.gif" WIDTH=142 HEIGHT=23 BORDER=0 ALT="Season and Hours"></A>'; } 
			<A HREF="http://naniboujou.com/history.php"
				ONMOUSEOVER="changeImages('history', 'images/history-over.gif'); return true;"
				ONMOUSEOUT="changeImages('history', 'images/history.gif'); return true;">
</TD>
	</TR>
	<TR>
		<TD>
		if ($thisfile == 'history.php') { echo ' <IMG src="images/information-over.gif" WIDTH=142 HEIGHT=23 BORDER=0 ALT="Information">'; } else{ echo '<IMG NAME="season" SRC="images/information.gif" WIDTH=142 HEIGHT=23 BORDER=0 ALT="Season and Hours"></A>'; } 
				</TD>
	</TR>
	<TR>
		<TD>			<img src="images/new_menu_07.gif" width="142" height="34"></TD>
	</TR>
</TABLE>
?>

but its giving me errors on the <table> tag
pj

Member Avatar

diafol

You can't put naked html inside <?php ... ?> tags.

I'm sorry to say this pj, but your html looks all 1980s. You've got CAPITAL letters for your tag elements and you don't contain your attribute values in quotes - well not consistently. I suppose it's html after a fashion, but things have moved on since then - most people are using a certain flavour of xhtml these days. Anyway, this is a side issue.

Anything you want outputted to the screen via php must use echo (or print) and that includes html. All non-php stuff must be enclosed in quotes if it is to be parsed correctly.

1980's ahhh!! those were terrible years... for HTML too... im sorry for my messyness.. i am veyr neat actually, but not my html... shoot.. im trying my best...
can you give me an example of how one would look:

<TD>
if ($thisfile == 'history.php') { echo ' <img name="season" src="images/history-over.gif" width=142 height=23 border=0 alt="Season and Hours"></A>'; } else{ echo '<img name="season" SRC="images/history.gif" width=142 height=23 border=0 alt="Season and Hours"></A>'; } 

<a href="http://naniboujou.com/history.php"
				ONMOUSEOVER="changeImages('history', 'images/history-over.gif'); return true;"
				ONMOUSEOUT="changeImages('history', 'images/history.gif'); return true;">
</TD>

thanks again for your time, i really appreciate it
pj

Member Avatar

diafol

<TD>
<?php
if ($thisfile == 'history.php') { echo ' <img name="season" src="images/history-over.gif" width=142 height=23 border=0 alt="Season and Hours"></A>'; } else{ echo '<img name="season" SRC="images/history.gif" width=142 height=23 border=0 alt="Season and Hours"></A>'; } 
?>

<a href="http://naniboujou.com/history.php"
				ONMOUSEOVER="changeImages('history', 'images/history-over.gif'); return true;"
				ONMOUSEOUT="changeImages('history', 'images/history.gif'); return true;">
</TD>

great, thanks
the issue i am having now, is if i click on history, and goto history.php, it shows history with a drop shadow, indicating that i am at HISTORY... but if i move my house over any of them, the drop shadow does not come back.. they are all drop-shadow-less, even history, the current page i am on...
here is what i have:

<A HREF="http://naniboujou.com/history.php"
				ONMOUSEOVER="changeImages('history', 'images/history-over.gif'); return true;"
				ONMOUSEOUT="changeImages('history', 'images/history.gif'); return true;">
<?php 
$thisfile = basename($_SERVER['PHP_SELF']);
if ($thisfile == 'history.php') { echo ' <IMG NAME="history" src="images/history-over.gif" WIDTH=142 HEIGHT=23 BORDER=0 ALT="history">'; } else{ echo '<img name="history" src="images/history.gif" width=142 height=23 border=0 alt="history">'; } ?>
</a>

(i notice if i change the ONMOUSEOUT="changeImages to a lowercase i, it then will hold, but will not update as i move my mouse up and down either, showing that they are active links...

thanks again
pj

Member Avatar

diafol

Sorry, I'm not replying to any more posts until Dani sorts out the mess with regard to this makeover. I'm getting a nosebleed every time I try to open my old posts.

Last one for now: forget js mouseover - use css sprites to create the rollover effect. Just Google css sprites and you'll see what I mean.

However for now, if you need to use your js rollovers, a simple php menu:

<?php
$menu_item_array = array(
    array("page" => "history.php", "title" => "go to the history page","img1"=>"/images/history.gif","img2"=>"/images/history-over.gif","alt" => "this is the history page","hook"=>"history"),
    array("page" => "about.php", "title" => "find out all about us","img1"=>"/images/about.gif","img2"=>"/images/about-over.gif","alt" => "this is the about us page","hook"=>"about")
 );

echo '<ul id="nav">';

foreach($menu_item_array as $item){
  if(basename($_SERVER['PHP_SELF']) == $item['page']){
    echo "<li><img src=\"{$item['img1']}\" alt=\"{$item['alt']}\" /></li>"; //no link
  }else{
    echo "<li><a href=\"/{$item['page']}\" title=\"{$item['title']}\" onmouseover=\"changeImages('{$item['hook']}', '{$item['img2']}'); return true;\" onmouseout=\"changeImages('{$item['hook']}', '{$item['img1']}'); return true;\"><img src=\"{$item['img1']}\" alt=\"{$item['title']}\" /></a></li>"; //links to other pages
  }
}
echo "</ul>";
?>

Sorry off the top of my head - probably bugged to hell and back.