10
Here's an amazingly simple PHP-based countdown timer I found. We chose to use this script over a Javascript version because we have a lot of dial-up visitors and adding more javascripts to the site was slowing it down.
Live demo (bottom-right block on homepage):
http://cit.wvup.eduJust paste the following code (exactly as shown) in a Custom PHP block and edit to suite:
?>
// enter target date below like this: "January 2, 2001"
$target = "February 10, 2006";
// enter string of what this start date is. $top_text appears above the counter, $bottom_text displays below the counter
$top_text = "There are ";
$bottom_text = "until the last day to apply to graduate in May!";
//--------------------------
$now = strtotime ("now");
$then = strtotime ("$target");
$difference = $then - $now;
$num = $difference/86400;
$days = intval($num);
$num2 = ($num - $days)*24;
$hours = intval($num2);
$num3 = ($num2 - $hours)*60;
$mins = intval($num3);
$num4 = ($num3 - $mins)*60;
?>
echo $top_text ?>
echo $days ?> |
: |
echo $hours ?> |
: |
echo $mins ?> |
Days |
| |
Hrs |
| |
Mins |
echo $bottom_text ?>
It may look like there are extra short tags ?> at the begining and ending of the script. There are not. Those are put there to force XOOPS to allow for user-controlled switching of PHP and HTML. Otherwise, all the above HTML would have had to have been output using lines like echo ('
');. Way too messy and time consuming.
Essentially, by placing a ?> at the beginning and a at the end of your PHP block, you nullify the unseen and ?>, thereby allowing you to define where YOU want your PHP and HTML and making troubleshooting 10x easier.
Hope this helps. Sorry for getting off topic towards the end there.
James
Insanity can be defined as "doing the same thing over and over and expecting different results."
Stupidity is not a crime. Therefore, you are free to go.