|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
ksk Smarty n00b
Joined: 21 Feb 2010 Posts: 2
|
Posted: Mon Feb 22, 2010 4:27 pm Post subject: URGENT! Help on countdown |
|
|
Im using an ecommerce website that using smarty template.
and i look in this MARINEDEPOT DOT COM
it got the countdown script using javascript and phpserver time,
i got the code
Code: |
<script type="text/javascript">
<!--
var StartMinutes = 959; -----------> This is from server time
var WorkSeconds = 13; ----------->This is from server time
function updateClock() {
var MinLeft = StartMinutes % 60;
var HourLeft = Math.floor(StartMinutes / 60);
if (StartMinutes <= 0 && WorkSeconds <= 1) {
document.getElementById("DayDealTimeSpan").firstChild.nodeValue = "0:00:00";
return;
}
var TxtMin = MinLeft;
if (MinLeft < 10)
TxtMin = "0" + MinLeft;
var TxtSec = WorkSeconds;
if (WorkSeconds < 10)
TxtSec = "0" + WorkSeconds;
var ShowString = HourLeft + ":" + TxtMin + ":" + TxtSec;
document.getElementById("DayDealTimeSpan").firstChild.nodeValue = ShowString;
WorkSeconds--;
if (WorkSeconds < 0)
{
WorkSeconds = 59;
StartMinutes--;
}
return;
}
setInterval('updateClock()', 1000);
// -->
</script>
|
I guest he is set hours,minutes,left in php and extract it to javascript, and display it.
anyone got a clue for the
var StartMinutes = ? is it <?php servertime/60/60 or something else?
thanks |
|
Back to top |
|
ksk Smarty n00b
Joined: 21 Feb 2010 Posts: 2
|
Posted: Mon Feb 22, 2010 4:29 pm Post subject: |
|
|
just like this
var StarMinutes = (servermode=="server-php")? '<? print date("F d, Y H:i:s", time())?>' : (servermode=="server-ssi")? '<!--#config timefmt="%B %d, %Y %H:%M:%S"--><!--#echo var="DATE_LOCAL" -->' : '<%= Now() %>' |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|