luchofox Posted October 25, 2013 Share Posted October 25, 2013 Hi, i need some help with this I would like to add a CLOCK (like "Today is 10/24/2013 - 2:29 PM") on the header (top of page) of my theme How can i do that? I have identified the block where it will go, only needs to know how add the code (and the code) i think could be with javascript... Could anyone help me please. Attached is an image for better reference. I identified the TPL, its blockpermantlinks-header.tpl and i'll replace some content with this new clock function. Thanks! Link to comment Share on other sites More sharing options...
NemoPS Posted October 26, 2013 Share Posted October 26, 2013 As you probably want it to refresh in real time, you can use javascript, like here: http://stackoverflow.com/questions/2604450/how-to-create-a-jquery-clock-timer Link to comment Share on other sites More sharing options...
vekia Posted October 26, 2013 Share Posted October 26, 2013 try with this code: <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> function showTime() { var today=new Date(); var h=today.getHours(); var m=today.getMinutes(); var s=today.getSeconds(); // add a zero in front of numbers<10 h=checkTime(h); m=checkTime(m); s=checkTime(s); $("#clock").text(h+":"+m+":"+s); t=setTimeout('showTime()',1000); } function checkTime(i) { if (i<10) { i="0" + i; } return i; } showTime(); </script> <div id="clock"></div> insert <div id="clocl"></div> there where you want to display clock 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now