Old 17-10-2006, 12:45   #1 (permalink)
chris_bcn
Goodbye little old lady
 
chris_bcn's Avatar
 
Join Date: Jun 2005
Location: Geordie in SF
Posts: 339
Send a message via MSN to chris_bcn
PHP image countdown

I have a banner that needs to countdown - i.e 10 days to go, and then the next day swap it out with 9 days to go etc...

I figured I could get todays day, and use that as the name of the image.

Can you see why this doesn't work?

<?php

$today_image = "/i/banner_preview_" . date('1') . ".gif";

if (file_exists('/path/to/image/' . $today_image)) { ?>

<a href="URLHERE.html"><img src="<?php echo $today_image ?>"></a>

<?php } else { ?>

DEFAULT IMAGE IN CASE

<?php } ?>
  Reply With Quote
Old 17-10-2006, 13:03   #2 (permalink)
d3mcfadden
Senior Member
 
d3mcfadden's Avatar
 
Join Date: Apr 2005
Location: -
Posts: 694
Send a message via AIM to d3mcfadden
try wrapping your varible in curly brackets
{$today_image}
  Reply With Quote
Old 17-10-2006, 13:29   #3 (permalink)
chris_bcn
Goodbye little old lady
 
chris_bcn's Avatar
 
Join Date: Jun 2005
Location: Geordie in SF
Posts: 339
Send a message via MSN to chris_bcn
cheers for that - but i does in fact work, just me being an idiot. It was returning Tuesday, and my image was tuesady.gif
  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