PDA

View Full Version : Could use assistance with a script please



Baralis
06-15-2015, 06:48 PM
1) Script Title: Local Time Script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex6/localtime.htm

Greetings,

I am attempting to build a webpage that lists the members of a gaming guild and their current time to better help members get in touch with those with similar schedules. I am doing this by creating a table with each members name, followed by their time zone, and finally their local live time. I am new to javascript so I was looking around the web for scripts that I could incorporate into my webpage to accomplish this. "Local Time script" seemed to fit what I needed perfectly however I cannot get it to function.

I created a generic test page on my virtual test server. I copied and pasted step 1 into the head section. I then pasted
<span id="timecontainer"></span> into my table which is in the body section and at the end of my body section I put
<script type="text/javascript">
new showLocalTime("timecontainer", "server-php", 0, "short")
</script> however it only gives me readout of NaN:NaN:NaN AM (undefined).

Am I missing some configuration or is it something else?

Here are environment details:
Windows Server 2008 R2 in Virtualbox
IIS 7
Php v5.3.28
Viewing with Firefox 38.0.5

Any pointers would be appreciated, thanks!

ddadmin
06-15-2015, 07:26 PM
For PHP pages, the script uses the following PHP code to retrieve the server's date as a string:


<? print date("F d, Y H:i:s", time())?>

If you add just the above code to your PHP page, does it output a date string?

Baralis
06-15-2015, 07:40 PM
For PHP pages, the script uses the following PHP code to retrieve the server's date as a string:


<? print date("F d, Y H:i:s", time())?>

If you add just the above code to your PHP page, does it output a date string?


Thank you for the reply ddadmin.


It does not display anything.

EDIT:
I went ahead and moved the page over so that it could be displayed publicly. http://shadyvalesyndicate.com/timer.php

The stand alone

<? print date("F d, Y H:i:s", time())?>
I have placed between the welcome and the table.

ddadmin
06-15-2015, 11:36 PM
Hmm it seems your server isn't recognizing the code in between <? ?> as PHP code. What if you changed it to:


<?php print date("F d, Y H:i:s", time())?>

Do you know for sure that PHP code gets executed on your server on pages with .php extension?

Baralis
06-15-2015, 11:48 PM
Hmm it seems your server isn't recognizing the code in between <? ?> as PHP code. What if you changed it to:


<?php print date("F d, Y H:i:s", time())?>

Do you know for sure that PHP code gets executed on your server on pages with .php extension?

That fixed it!

I really appreciate your help, thank you so much.