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

Change image on serten time!

Status
Not open for further replies.

HuggerFanta

Technical User
Apr 22, 2002
87
0
0
SE
Hello forum!
I want to find a script that change an image that only going to be displayed on a specific day, and then nevere again, is this possible???

Where can i find this kind of script??? --------------------------------------
Kind regards;
HuggerFanta
 
Just check the date against your target date every time the page is accessed:
Code:
$myDate = "1/1/2003";         // target date
$today = (date ("n/j/Y"));  // today's date

if ($myDate == $today) {
    // display one-time graphic
}
else {
    // standard behavior
}

Now . . . don't go launching any time bombs! ;-}
 
Thanks, but how do I get the image code to right.

i don´t se the image, just blank!!! --------------------------------------
Kind regards;
HuggerFanta
 
Well . . . you're wanting this to display in an HTML page, right? Just call the image using HTML tags within an echo:
Code:
$myDate = "1/1/2003";         // target date
$today = (date ("n/j/Y"));  // today's date

if ($myDate == $today) {
    // display one-time graphic
    echo '<img src=&quot;/images/yourGraphic.gif&quot; />';
}
else {
    // standard behavior
    echo '<img src=&quot;/images/null.gif&quot; />';
}

The details of how you implement this code depends on where and how you want to use it within your HTML.

If you're new to this and still have trouble, I can offer some limited help with your actual code. Just let me know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top