Customizing SMF > Tips and Tricks

Live clock in header

<< < (3/33) > >>

!RFAN:

--- Code: ---echo '
  <div id="linkt">
      <div id="timef">', $context['current_time'], '<div>

        </div>';

--- End code ---

what should i do???

K@:

--- Quote from: Joker™ on September 02, 2010, 09:52:21 PM ---can you elaborate the idea some more, sounds interesting.

--- End quote ---

Well, I guess you'd need settings to enter the towns/cities and stuff, wouldn't you? Plus the time-offsets and stuff.

It's easy enough to edit them, manually, but I suspect that, as a mod, people would kinda expect it to be "Click this, click that".

Joker™:

--- Quote from: !RFAN on September 03, 2010, 01:13:43 PM ---
--- Code: ---echo '
  <div id="linkt">
      <div id="timef">', $context['current_time'], '<div>

        </div>';

--- End code ---

what should i do???

--- End quote ---

Try this

--- Code: ---echo '<div id="linkt">

<div id="timef">',timeformat(time(),'%B, %d, %Y'), '
<div id="clock">Loading...</div>
<script type="text/javascript">
function refrClock()
{
var d=new Date();
var s=d.getSeconds();
var m=d.getMinutes();
var h=d.getHours();
var am_pm;
if (s<10) {s="0" + s}
if (m<10) {m="0" + m}
if (h>12) {h-=12;am_pm = "pm"}
else {am_pm="am"}
if (h<10) {h="0" + h}
document.getElementById("clock").innerHTML=h + ":" + m + ":" + s + am_pm;
setTimeout("refrClock()",1000);
}
refrClock();
</script></div></div>';
--- End code ---

Joker™:

--- Quote from: K@ on September 03, 2010, 01:20:36 PM ---Well, I guess you'd need settings to enter the towns/cities and stuff, wouldn't you? Plus the time-offsets and stuff.

It's easy enough to edit them, manually, but I suspect that, as a mod, people would kinda expect it to be "Click this, click that".

--- End quote ---
very nice idea we can work on that.

K@:

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version