Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

URGENT! Help on countdown

 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
ksk
Smarty n00b


Joined: 21 Feb 2010
Posts: 2

PostPosted: Mon Feb 22, 2010 4:27 pm    Post subject: URGENT! Help on countdown Reply with quote

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
View user's profile Send private message
ksk
Smarty n00b


Joined: 21 Feb 2010
Posts: 2

PostPosted: Mon Feb 22, 2010 4:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP