A block that shows dynamic SERVER time
-> HowTo & Allgemeine Fragen

#1: A block that shows dynamic SERVER time Autor: raffe BeitragVerfasst am: 22.11.2006 16:54
    ----
Sorry can no German schüchtern , so I write in English. I would like a block that shows a ticking clock that shows the time on

the SERVER. Like this:
www.javascriptkit.com/...time.shtml
or
www.dynamicdrive.com/d...altime.htm
or
www.developertutorials...0&vt=0

The only block I have found is "Clock and Calendar" (Calendar v3.0 for

Dragonfly CMS: block-Calendar.php) from

dragonflycms.org/Downl...d=386.html but I can only

get it to show the time on the client.

My last try I did like this.
1. I make a new block and in the "Content:" I write:
Array:
[align=center]<iframe src="iframes/time.htm" width="500" 
height="55" border="0" frameborder="0"></iframe>[/align]

2. In iframes/time.htm:
Array:
<html><HEAD>
<script language="JavaScript" src="/iframes/servertime.php"></script>
<script type="text/javascript">
<!-- Begin
var servertimeOBJ;
var myscriptTime;
// End -->
</script>
</HEAD>
<BODY><p align=center>
<script type="text/javascript">
<!-- Begin
document.write(servertimeOBJ)
// End -->
</script></p></body></html>

3. in /iframes/servertime.php:
Array:
<?php
error_reporting(0);
$mydate = date("U");
print "var servertimeOBJ=new Date(($mydate)*1000);";
?>

It works OK, I get something like this:
Wed Nov 22 21:42:48 UTC+0800 2006

But the time don't tick. I have tried to play with this in time.htm in

the head:
Array:
function newtime()
{
setTimeout(window.location.reload(), 1000) 
}

In in the body:
Array:
<script type="text/javascript">
<!-- Begin
document.write(servertimeOBJ)
newtime()
// End -->
</script>
But it don't work. Just reloads all the time and no time shows at all.

Any ideas?



-> HowTo & Allgemeine Fragen

Alle Zeitangaben sind in GMT + 1 Stunden

Seite 1 von 1