I'm running a website and I need a simple way to have an item show for example, "Day's left (# number of days left)" and automatically change after each day. Can it be done with HTML?
That's what I'm afraid of. I need to be able to display it in a message board post like this one and scripts aren't allowed.
Originally Posted by dtm32236
you could use a server side language and have it change an image...
So you mean like image rotation?
Originally Posted by scragar
very similar idea, here's a PHP version:
shouldn't be too hard to make versions in other languages.
// set header.
header ("Content-type: image/png");
// get time string.
$theTime = strtotime("10 September 2008"); // set your date of choice.
$now = strtotime("now");
$timeLeft = $theTime - $now;
$days = floor($timeLeft/60/60/24);
$theText = ($days==1)?"1 day left":$days . " Day(s) left";
$theText = "You've missed it";
// create image.
$im = @imagecreatetruecolor(120, 20) or die("Cannot create new image");
// assign colours, using rgb.
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
// fill image and add text.
imagefill($im, 1, 1, $white);
imagestring($im, 1, 5, 5, $theText, $black);
// show image.
// destroy image to save memory.
you can see this in action here
Last edited by scragar; 01-07-2008 at 09:33 PM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)