Old 11-06-2008, 14:29   #1 (permalink)
shaftb
Senior Member
 
shaftb's Avatar
 
Join Date: Jul 2006
Location: Midwest
Posts: 340
Send a message via AIM to shaftb
PHP image swap :: NOT RANDOM

I'm looking for a PHP script or tutorial on how to switch out images.
I have images as page headers, and instead of having separate css for each page to call the image for the div, I'd like to use the same CSS and pop in a PHP script if possible. Unless that is a bad way to do it, or harder
__________________
Daughter of Aphrodite-Hear my words and take Heed-I was born on Olympus-To my father a Son-I was raised by the demons-Trained to reign as the One.
  Reply With Quote
Old 11-06-2008, 14:51   #2 (permalink)
datahound
Spare Parts
 
datahound's Avatar
 
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 4,996
Do you want a differnt image to load on the page every time it is refreshed?
__________________
  Reply With Quote
Old 11-06-2008, 14:52   #3 (permalink)
pgo
Senior Member
 
Join Date: Jan 2005
Posts: 12,340
Not sure what you're asking.

Are you trying to change images on page loads or without page loads?
  Reply With Quote
Old 11-06-2008, 14:54   #4 (permalink)
datahound
Spare Parts
 
datahound's Avatar
 
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 4,996
Do you want this to load when the page loads or on the load pages?
__________________
  Reply With Quote
Old 11-06-2008, 14:56   #5 (permalink)
robdesign
Registered User
 
Join Date: May 2008
Posts: 62
Send a message via AIM to robdesign Send a message via MSN to robdesign
  Reply With Quote
Old 11-06-2008, 15:24   #6 (permalink)
shaftb
Senior Member
 
shaftb's Avatar
 
Join Date: Jul 2006
Location: Midwest
Posts: 340
Send a message via AIM to shaftb
No random image. No refresh.

Here is a link to what I have, I want it to change that title bar when the user goes to THAT specific page. I know I can do it using CSS. Do you thinking just popping in a additional style sheet with that div info in there is good enough?

Legacy Tours & Travel | Decorah, Iowa | 800-323-3368
__________________
Daughter of Aphrodite-Hear my words and take Heed-I was born on Olympus-To my father a Son-I was raised by the demons-Trained to reign as the One.
  Reply With Quote
Old 11-06-2008, 15:36   #7 (permalink)
datahound
Spare Parts
 
datahound's Avatar
 
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 4,996
How big is that image, I'm still waiting?
__________________
  Reply With Quote
Old 11-06-2008, 15:45   #8 (permalink)
n21design
All mixed up
 
n21design's Avatar
 
Join Date: Jun 2007
Location: Lima, Peru
Posts: 141
Send a message via ICQ to n21design Send a message via AIM to n21design Send a message via MSN to n21design Send a message via Yahoo to n21design
Quote:
Originally Posted by datahound
How big is that image, I'm still waiting?

LOL
  Reply With Quote
Old 11-06-2008, 15:52   #9 (permalink)
shaftb
Senior Member
 
shaftb's Avatar
 
Join Date: Jul 2006
Location: Midwest
Posts: 340
Send a message via AIM to shaftb
Quote:
Originally Posted by datahound
How big is that image, I'm still waiting?


Let me guess, you're using IE and getting an error due to the PNG?
I am working on that, any insight on that would be great.
__________________
Daughter of Aphrodite-Hear my words and take Heed-I was born on Olympus-To my father a Son-I was raised by the demons-Trained to reign as the One.
  Reply With Quote
Old 11-06-2008, 15:57   #10 (permalink)
datahound
Spare Parts
 
datahound's Avatar
 
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 4,996
Yes IE it won't load, I have no ideason that.
__________________
  Reply With Quote
Old 11-06-2008, 17:56   #11 (permalink)
datahound
Spare Parts
 
datahound's Avatar
 
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 4,996
Here is a little something that may help.

Test Current File


Code:
<html> <head> <title>Test Current File</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- body { background-color: <?php if ($PHP_SELF == '/testcurrentfile/test1.php'){echo("#CCFF33");} elseif ($PHP_SELF == '/testcurrentfile/test2.php'){echo("#66CCFF");} elseif ($PHP_SELF == '/testcurrentfile/test3.php'){echo("#FF9933");} ?>; } --> </style> </head> <body> <p>TEXT</p> <p>--> <?php echo $PHP_SELF; ?></p> <p><a href="test1.php">test 1</a></p> <p><a href="test2.php">test 2</a></p> <p><a href="test3.php">test 3</a></p> </body> </html>
__________________
  Reply With Quote
Old 11-06-2008, 19:36   #12 (permalink)
Shiro
shiro
 
Shiro's Avatar
 
Join Date: Aug 2007
Location: Yokohama, Japan
Posts: 2,688
You can do this purely in CSS.

Give the body tag of each page an id:

Code:
<body id="index"> <body id="about_us">

Then you create a div (or whatever) to hold the image, and give it an ID.

Code:
<div id="background_image">

Then you create different CSS declarations for the different pages:

Code:
#index #background_image { background-image: url(path/to/index_page_image.png); } #about_us #background_image { background-image: url(path/to/about_us_page_image.png); }
__________________
This space for rent.

Dads Japan
After Hours Japan
  Reply With Quote
Old 12-06-2008, 12:25   #13 (permalink)
shaftb
Senior Member
 
shaftb's Avatar
 
Join Date: Jul 2006
Location: Midwest
Posts: 340
Send a message via AIM to shaftb
Cool, thanks, I'll try these out.

Anybody else know a work around on that damn PNG issue in IE?

thx
__________________
Daughter of Aphrodite-Hear my words and take Heed-I was born on Olympus-To my father a Son-I was raised by the demons-Trained to reign as the One.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8