TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,018
  • Total Topics: 21,332
  • Online today: 1,891
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 1293
  • Total: 1293

digital clock

Started by evulness, April 15, 2008, 03:53:56 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

evulness

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>
';

Smoky

very nice evulness  :D im sure this will get some use here!! thanks  ;)

evulness

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?

MTF95


evulness

erm, yea.... top of the left column at www.liekninja.com
(site is under construction, so don't mind the blandness)

MTF95

Is it possbile to make the seconds tick? Right now it stands still untill I update the page.

JPDeni

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.

Smoky

or you could search for "flash clocks" and find something that would make you happy.. i found a cherry clock for my site.. it's perfect!!  :D

MTF95

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?

Smoky

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 ;)

JPDeni

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.

MTF95

Thank's!

Great clock, but I like the flash clock I found better :)

Crip

here is one i posted a few years back/clock/cal combo:
http://www.tinyportal.net/index.php?topic=1509.0
I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



Crip

I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



This website is proudly hosted on Crocweb Cloud Website Hosting.