Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mouse over graphics with PHP

Status
Not open for further replies.

estrellas

Programmer
Jul 16, 2004
48
US
hey guys -
i have a wierd question ... well its' wierd to me at least
so i wanted to make roll over buttons for my website. i amde them but decided that when a user was on a link, that that button should be different than the rest. now because i'm dealing with a site that has 100+ pages, i'm using dreamweaver (ugh).

so i wrote a script that should determine what graphic to display.

here's the html code
Code:
<td><a href="/history/index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('history','','/images/history_over.gif',1)" onMouseDown="MM_swapImage('history','','/images/history_down.gif',1)"><img src=<?php if ($thisPage=="history") echo '"/images/history_down.gif"'; else echo '"/images/history.gif"'; ?> alt="History" name="history" width="138" height="30" border="0"></a></td>
				<td><a href="/current/index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('current','','/images/current_over.gif',1)" onMouseDown="MM_swapImage('current','','/images/current_down.gif',1)"><img src=<?php if ($thisPage=="current") echo '"/images/current_down.gif"'; else echo '"/images/current.gif"'; ?> alt="Current" name="current" width="138" height="30" border="0"></a></td>

the MM functions are predefinied by dreamweaver and i haven't touched them so i know those are okay.
now depending on what folder i'm in .. (history or current) i have in the header
Code:
 <?php $thisPage="history"; ?>
(or thisPage = current if the page is under the current folder)

do you have any reason why this is not working? my title banner graphic is not being displayed anymore either as an effect of this.

thanks in advance. i really appreciate it guys. :)

-------
 
Can you post a link so we can see it (not) work?
 
lol i'd ask the same quesiton too if i was answering .. lemme go check with my boss about security rights and stuff to see if i can upload it to the extermal server. i'm pretty sure i can't until the site is fully activated but i'll check and get back .. cheers :)

-------
 
or, at least post all your php in the file.

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
Another suggestion:
Instead of using PHP just use JavaScript.
Have a JavaScript be called onLoad in the <body> tag and evaluate the location by parsing the URL string. If it contains 'history' set the source for the history link to the desired image.
There is a whole tutorial how to do this with Fireworks/Dreamweaver. The most interesting page has short JavaScript code and explanations here:
 
yeah, i think i may do that ... i like php a whole lot better than javascript, but i'm so retarded even fro asking for help when i really can't show you guys what's wrong with this...thanks so much tho for helping and definitely i'll take a look at that link :)
cheers :)

-------
 
No need to castrate yourself!

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top