cliftonbazaar Posted April 18, 2009 Share Posted April 18, 2009 I've seen this on several facebook pages - a timer that counts down to show you when you can have your next turn. It is written in PHP but I have no idea how to do it Any suggestions? Link to comment https://forums.phpfreaks.com/topic/154631-timers-shown-on-pages/ Share on other sites More sharing options...
Mchl Posted April 18, 2009 Share Posted April 18, 2009 It is not written in PHP. At least not entirely. If you see the page dynamically changing content in your browser, it most likely involves JavaScript (or Flash) Link to comment https://forums.phpfreaks.com/topic/154631-timers-shown-on-pages/#findComment-813124 Share on other sites More sharing options...
PFMaBiSmAd Posted April 18, 2009 Share Posted April 18, 2009 The way that results in the minimum server load is if a page is requested that has a time limit on it, the page that is output contains a javascript count down timer and it is given the current time remaining to count down from. If the page is refreshed or otherwise requested again, the current time remaining is given to the javascript count down code for it to count down from. If the page is requested with zero time remaining (determined on the server) the normal page is output without the count down code used to display the time remaining. When the javascript count down timer reaches zero (plus a small amount (1-2 seconds) to account for timebase differences between the client and the server), it can make a http request to request the page and since the time remaining (determined on the server) is now zero, the normal page is output without the count down code used to display the time remaining. Link to comment https://forums.phpfreaks.com/topic/154631-timers-shown-on-pages/#findComment-813128 Share on other sites More sharing options...
soak Posted April 18, 2009 Share Posted April 18, 2009 If you use jQuery then jClock is very easy to use: http://jquery.jclock.js.googlepages.com/ Link to comment https://forums.phpfreaks.com/topic/154631-timers-shown-on-pages/#findComment-813129 Share on other sites More sharing options...
cliftonbazaar Posted April 18, 2009 Author Share Posted April 18, 2009 Thanks for all the replies; I'll start looking at that link now Link to comment https://forums.phpfreaks.com/topic/154631-timers-shown-on-pages/#findComment-813448 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.