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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Load Image Dependant on the Date?

Status
Not open for further replies.

kgaard

Programmer
Nov 23, 2003
18
US
I'm fairly new to PHP, and am curious if it would be possible to load different images (actually, .swf files) depending on the date? so that, each on the 1st of each month, a different swf loads for the duration of the month. I'd bet its possible, but I'm not entirely sure how to go about it. any tips/ideas?

thanks!
 
Don't think of it as loading different .swf files each month. Think of it as having a PHP script produce different HTML pages, each containing a reference to a different .swf file, for each month.

A simple example, rotating a JPEG monthly, could be something like:

<?php
print '<html><body>';

$month = date ('m');

print '<img src="/some/path/to/image' . $month . '.jpg'">';

print '</body></html>';
?>


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
excellent help! - though I'm getting an error kicked back at me from this line:

print '<img src="/some/path/to/image' . $month . '.jpg'">';

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING

i think i've tried every combination of single and double quotes out there and not getting anywhere - sorry to be a such a newbie!

I thought in theory it should be:
print '<img src="'/some/path/to/image' . $month . '.jpg'">';

but then print only goes to the end of the img src=

silly newbies error i'm sure.. hehe


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top