I needed a digital clock for one of my sites.
and so this was made.
Simple. No its not simplified more. I'll leave that to you neat freaks.
Attached a thumbnail, and zip with images.
pretty much all you need to do, is make a php block, paste this code. and copy the clock folder in my zip, into the "images" folder of any template. would probably work for all templates if you put the clock folder into the default/images folder. idk, haven't tried it.
if you don't like my digits. Customization is easy.
just make a new set of digits.
Open your image editor, make a NEW image, Type a digit, crop the image down to the size of the digit, save it to the clock folder. tada (may have to change file extension in script, to match your images extensions)
other than that...
enjoy :)
$hour = date(h);
$minute = date(i);
$second = date(s);
$time = date(H);
if($time<=12){$rtime = 'am';}else{$rtime ='pm';}
$sec = preg_split('//', $second, -1, PREG_SPLIT_NO_EMPTY);
$min = preg_split('//', $minute, -1, PREG_SPLIT_NO_EMPTY);
$hour = preg_split('//', $hour, -1, PREG_SPLIT_NO_EMPTY);
echo '
<div style="
width:200px;
height:25px;
font-weight:bold;
background:#666666;
border:solid 1px #000000;
">
<img src="', $settings['images_url'], '/clock/'.$hour[0].'.png" />
<img src="', $settings['images_url'], '/clock/'.$hour[1].'.png" />
<img src="', $settings['images_url'], '/clock/colon.png" />
<img src="', $settings['images_url'], '/clock/'.$min[0].'.png" />
<img src="', $settings['images_url'], '/clock/'.$min[1].'.png" />
.
<img src="', $settings['images_url'], '/clock/'.$sec[0].'.png" />
<img src="', $settings['images_url'], '/clock/'.$sec[1].'.png" />
<img src="', $settings['images_url'], '/clock/'.$rTime.'.png" />
</div>
';
very nice evulness :D im sure this will get some use here!! thanks ;)
hey, this is all a learning process for me :)
If someone can get some use out of the random stuff i make.... then why not?
Any live demo avaible?
erm, yea.... top of the left column at www.liekninja.com
(site is under construction, so don't mind the blandness)
Is it possbile to make the seconds tick? Right now it stands still untill I update the page.
It probably would be a better idea to eliminate the seconds and just have the hour and minutes displayed. Since the script uses images, it may often take longer than one second for a user's browser to download the image, so the seconds would be wrong anyway.
If you want a "live" clock, try some of them at http://www.dynamicdrive.com/dynamicindex6/index.html I don't think any of these use images, though.
or you could search for "flash clocks" (http://www.google.com/search?client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&channel=s&hl=en&q=flash+clocks&btnG=Google+Search) and find something that would make you happy.. i found a cherry clock for my site.. it's perfect!! :D
Is it possible to input
<embed src="http://freeflashclocks.com/free-flash-clocks-for-websites/free-flash-clock-8.swf" width="150" height="150" wmode="transparent" bgcolor="" type="application/x-shockwave-flash">
</embed>
in a block?
yes, you can do that, and to adjust the size of the clock, you can play with the height and width till you get it the way you want it.. :D ;)
Whenever I wonder if something is possible, I just do it and see. I don't think anything that's done in TP will cause a rift in the time/space continuum ;) so no harm can be done. At the very worst, you might have to access the database through phpMyAdmin to delete the block.
Anyway, give it a try in a scriptbox.
Thank's!
Great clock, but I like the flash clock I found better :)
here is one i posted a few years back/clock/cal combo:
http://www.tinyportal.net/index.php?topic=1509.0
And this one is small and black..clock only:
http://www.tinyportal.net/index.php?topic=16478.0