Jump to content

Countdown timer unable to get current time


wolfkin

Recommended Posts

I'm working with a script from DD

http://www.dynamicdrive.com/dynamicindex6/universalcountdown.htm

 

I manage to get everything in my site but my debug mode shows that it's unable to get the current time

 

31theseries.com

 

ehh i'll turn off the Debug and show you here

 

http://bit.ly/gUcQ7U

 

On my local server I get "Invalid Date" instead of the current time

 

on my web server

Debug Mode on!

Current Local time: December -2147483629, 1969 -8:-31:-23 GMT-05:00

Verify this is the correct current local time, in other words, time zone of count down date.

 

Target Time: March 31, 2011 3:31:00 PM GMT-04:00

Verify this is the date/time you wish to count down to (should be a future date).

 

NaN days NaN hours NaN minutes NaN seconds left until launch time

 

so obviously I'd like to get the correct time and that should give me the timer I want, but also I'm curious if there's a way to fix the time zone. My local time zone is GMT -05 I'm East Coast (Atlanta, Ga/ Toronto, On) I'm not sure why it's putting my time zone in GMT -04 still that's a minor concern I can adjust an hour if I can get everything else working.

Edited by wolfkin
Link to comment
Share on other sites

It's my understanding that if I didn't have PHP enables my .php files wouldn't work. and they do so I assume that yes I do have PHP. Here's what the index.php looks like. I've uploaded an entire copy of the site if anyone could test it and make sure my code is correct I would appreciate it.

31_demo.zip

 

<?php include 'inc/header.inc'?>

<section id="content" class="grid_12 align_center">
<a title="Logo" href="video_only"><img src="img/31logo.jpg" width="500" height="333" border="0" /></a>
<br />
<div id="countdown_timer"></div>
<script type="text/javascript">
//cdLocalTime("ID_of_DIV_container", "server_mode", LocaltimeoffsetMinutes, "target_date", "opt_debug_mode")
//cdLocalTime.displaycountdown("base_unit", formatfunction_reference)

//Note: "launchdate" should be an arbitrary but unique variable for each instance of a countdown on your page:

var launchdate=new cdLocalTime("countdown_timer", "server-php", 0, "March 31, 2011 15:31:00", "debug_mode")
launchdate.displaycountdown("days", formatresults2)
</script>
</section>

<?php include 'inc/footer.inc'?>

 

Here are the contents of the .zip file:

total 24
drwxr-xr-x@   204 Mar 10 11:52 css
drwxr-xr-x@   102 Mar 10 11:52 img
drwxr-xr-x@   136 Mar 10 11:52 inc
-rwxr-xr-x@   790 Mar 10 11:52 index.php
drwxr-xr-x@   102 Mar 10 11:52 js
-rwxr-xr-x@  5772 Mar 10 11:52 test.html

./css:
total 40
-rwxr-xr-x@  5600 Oct 28 11:48 960.css
-rwxr-xr-x@   227 Mar  9 22:50 countdown.css
-rwxr-xr-x@   648 Oct 28 11:48 reset.css
-rwxr-xr-x@   977 Mar  4 12:56 text.css

./img:
total 48
-rwxr-xr-x@ 20844 Mar  4 11:59 31logo.jpg

./inc:
total 16
-rwxr-xr-x@    28 Mar  9 21:52 footer.inc
-rwxr-xr-x@   667 Mar  9 23:49 header.inc

./js:
total 16
-rwxr-xr-x@  4867 Mar  9 23:34 countdown.js

Edited by wolfkin
Link to comment
Share on other sites

yeah i realize this.

I thought it meant that the server had to have PHP capability not that the page itself had to be explicitly labeled but I actually did try changing it to PHP and the page stopped loading period.

Alright there are now two files

http://bit.ly/fDQkNL (.html)- loads with the error

http://bit.ly/g8qJ4G (.php) - does not load at all.

 

here's what the source of the PHP version shows me

<html>
<head>

<style style="text/css">

.lcdstyle{ /*Example CSS to create LCD countdown look*/
background-color:black;
color:lime;
font: bold 18px MS Sans Serif;
padding: 3px;
}

.lcdstyle sup{ /*Example CSS to create LCD countdown look*/
font-size: 80%
}

</style>

<script type="text/javascript">

/***********************************************
* Universal Countdown script- © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function cdLocalTime(container, servermode, offsetMinutes, targetdate, debugmode){
if (!document.getElementById || !document.getElementById(container)) return
this.container=document.getElementById(container)
var servertimestring=(servermode=="server-php")? 'March 10, 2011 12:23:29' : (servermode=="server-ssi")? '<!--#config timefmt="%B %d, %Y %H:%M:%S"--><!--#echo var="DATE_LOCAL" -->' : '<br />
<b>Fatal error</b>:  Call to undefined function  now() in <b>/data/20/2/19/142/2508142/user/2747230/htdocs/test.php</b> on line <b>30</b><br />

 

I'm not sure what this means

Edited by wolfkin
Link to comment
Share on other sites

Try replacing line 30 that says:

 

var servertimestring=(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() %>'

 

to this:

 

var servertimestring=(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" -->' : ''

 

It's trying to process the asp code: <%=Now()%> which is weird ...

Edited by BeeDev
Link to comment
Share on other sites

Thanks for the help. I was talking it over with some of my twitter friends and they recommended I just switch timers.

 

I've instead moved on to this jquery countdown timer.

http://keith-wood.name/countdown.html

It actually would have gone a lot smoother had I realized days before that you can't start an ID with a number. I was just about to post here asking for help when I decided to see if my ID was the problem and voila.

 

So as you can see on the site (http://bit.ly/gEqd5k) I got the timer on. It's counting down fine. I even got the colors flipped. My issue now is that I can't seem to move the timer and I'm not sure why. I've tried using text-align center on that div which shouldn't work. Then I tried using auto margins which should work but doesn't.

offkilter.th.png

 

While we're at it. I have this odd issue where when you mouseover images that have links like the logo you get the highlight on a completely unrelated box like in the picture. I have no idea why and it doesn't happen on FireFox(sister's NetBook). Just on Chrome (my desktop) and Safari (my MacBook). Anyone have any idea what's going on?

 

Resolved:

So I'm not sure why but I've NEVER gotten the shorthand for centering using auto margins to work. But I tried specifying them individually and that worked. So I got my timer to center.

Edited by wolfkin
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...