MappingFOR
Web Developer
- Joined
- Jul 12, 2010
- Messages
- 35
- Reaction score
- 0
Create a "countdown.php" in "layout.php" folder.
Put that code in acc layout head:
Now, just place a text into site.
PL
US
+ The same time for all ppl.
Code:
<?php
header("Content-type: text/javascript");
$date = date('M d Y H:i:s');
print 'var now = new Date("'.$date.'");';
print 'function times() {
now.setSeconds(now.getSeconds()+1);
lat = new Date("0 0 0 20:00:00"); // SET TIME (it's generally 20)
var hour1 = now.getHours();
var minute1 = now.getMinutes();
var second1 = now.getSeconds();
var hour2 = lat.getHours() - 1;
var minute2 = lat.getMinutes() - 1;
var second2 = lat.getSeconds();
if(hour2 >= hour1){
hours = hour2 - hour1;
}else{
hours = 24 - (hour1 - hour2);
}
minutes = 60 - minute1;
seconds = 60 - second1;
if (hours < 10) { hours = "0" + hours; }
if (minutes < 10) { minutes = "0" + minutes; }
if (seconds < 10) { seconds = "0" + seconds; }
if (hours > 23) { hours = "23"; }
if (minutes > 59) { minutes = "59"; }
if (seconds > 59) { seconds = "59"; }
document.getElementById("hours").innerHTML = hours;
document.getElementById("minutes").innerHTML = minutes;
document.getElementById("seconds").innerHTML = seconds;
}
var animeInt;
clearInterval(animeInt);
animeInt = setInterval("times()", 1000);';
?>
Put that code in acc layout head:
Code:
<script src="countdown.php" type="text/javascript"></script>
Now, just place a text into site.
PL
Code:
<?php
$lang['pl']['time'] = "Do startu serwera pozostało: %s godzin %s minut %s sekund.";
printf($lang['pl']['time'],'<span id="hours"></span>','<span id="minutes"></span>','<span id="seconds"></span>');
?>
US
Code:
<?php
$lang['us']['time'] = "To server start remain: %s hours %s minutes %s seconds.";
printf($lang['pl']['time'],'<span id="hours"></span>','<span id="minutes"></span>','<span id="seconds"></span>'); ?>
+ The same time for all ppl.