servertime class readme.txt doc file Peter Klauer, September 7 2003 knito@knito.de Changes: October, 26 2003: Optional starting within the body tag per onload="clock()" (see Synchronisation) October, 3 2003: New Feature $offset_hours. Idea from Martin Link October, 1 2003: New Language "french" from Eric Mathieu September, 25 2003: New switch $ucaseampm for uppercase or lowercase am/pm. New Feature: Alarm clock times and output of alarm messages using a user defined php page. New vars: $alarmon, $alarmdate, $alarm, $onalarm, $alarmpage. Ideas and code contributions from Paul Hargreaves. September, 10 2003: New Switches "military" and "showdate" from Paul Hargreaves September, 11 2003: New Section "Synchronisation" Themes covered by this document: Functions in the class Variables in the class Example Synchronisation This class is called "servertime" and shows approximately the time of the server from which it had started. If $offset_hours is defined it will display the time and date plus $offset_hours. Javascript has to be enabled to have the clock work. The time is shown in a digital text clock which is situated in a
tag. The servers time is not shown in realtime: Until the time is taken over into the page and the javascript begins to run a cerain time span passes. Afterwards the clock runs with local speed. Please refer to the last section "Synchronisation". The feature "alarmtimes" allows the class to announce events for certain days and times. For example a sports page may announce a match that takes place at this moment (or in a few moments). You can test some of the variable settings for servertime on this page: http://www.ingoknito.de/scripts/servertime/index.php ******************************************************************************** ******************************************************************************** Functions in the class servertime: ******************************************************************************** ******************************************************************************** InstallClockHead() InstallClock() InstallClockBody() Help() ******************************************************************************** function servertime::InstallClockHead() ******************************************************************************** This function is to be placed into the section of the page. It installes the array of month names, the initial time value "digital" which is loaded with the current time from the server and a very common javascript function named "writeLayer" which does the writing of the clocks content into the page. I fount this function in so many places that I can not tell you who has it done. On http://beta.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20631686.html you fill find notice of a similar writeLayer function, but I do not have it from there and can not tell any more where I found it. I worked it over using Mozilla's Javascript Console until it did not show any more warnings. The clock will not make any output to the console if correctly installed. The following class variables cause installclockhead() to do something: language shorthmonth showdate onalarm alarmon offset_hours The following class variable is set to true when installclockhead() has run: ok_head ******************************************************************************** function servertime::InstallClock() ******************************************************************************** This function is to be called in the place where the clock shall be displayed. It must be placed after installclockhead() and before installclockbody(). The following class variables cause InstallClock() to do something: divclass divstyle divtag divid title ok_head The following class variable is set to true when installclockhead() has run: ok_clock ******************************************************************************** function servertime::InstallClockBody() ******************************************************************************** This function is to be placed near the very end of the page. It installes the javascript function "clock()" and the first call to this function. One of the improvements of this class facing the old script is that there is no need to put a kick starter "onload='clock()'" into the tag. The following class variables cause installclockbody() to do something: language military showdate ok_head ok_clock alarm alarmon onalarm alarmdate ucaseampm ******************************************************************************** function servertime::Help() ******************************************************************************** This is just a little extra function giving a short instruction how to use this clase in case this readme.txt is lost. ******************************************************************************** ******************************************************************************** Variables in the class ******************************************************************************** ******************************************************************************** divid string Holds the default id name of the clock tag. 'Pendule' is the default id name. divstyle string Holds the default style string for the clock tag. 'position:absolute;' is default for making NS 4.7 work. I think this is deprecated and could be killed with a ''. As a matter of fact the clock will overwrite the next following line in some browsers if this default value is kept. But I am not yet ready to drop NS 4.7 out of the scope of this class. divtag string Holds the clock's tag "species". 'div' is default, other possibility: 'span'. divclass string Holds a classname for the divtag. The class must be defined in an external style sheet or in a