Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Local Time Script & Frontpage

  1. #1
    Join Date
    Mar 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Local Time Script & Frontpage

    Local Time Script
    http://www.dynamicdrive.com/dynamicindex6/localtime.htm

    Hi everyone, I have been pulling my hair out over this one. I followed the directions on the site, but I don't comprehend everything. I am still a beginner.

    I made a simple page, but all that would show is
    "Current Server Time:NaN:NaN:NaN AM (undefined)"

    I am not sure what the problem is. I think it is either:
    1. frontpage 2003 is giving me problems
    2. my page might be 100% html, so my page is not configured to display things properly.
    3. my server is not set up correctly

    note: I am using IX web hosting on their expert plan and I have SSI, PHP and frontpage extensions on.

    Here is the actual page:
    http://kietphan.com/localtime_test_page.htm

    Please save me from going balder. Any suggestions?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    From what I can tell, your page is correct. A fine point, the title should go before the script, shouldn't make any practical difference but is good valid form and practice. The trouble is that since you are using the php method, your page's extension needs to be .php not .htm:

    From the Demo Page:

    Description: Want to display the current local time of a specific place in the world? This DHTML script, with the help of either PHP, ASP, or SSI (server side includes), displays the current server time your site is hosted on, and in turn, the local time of anywhere on Earth. You can use it to show visitors your current local time, or the time in New York, Tokyo etc. Now, in order to use this script, the webpage you're adding it to must be either PHP (ie: .php), ASP, or SSI (ie: .shtml) enabled. More on this below.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Mar 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi jscheuer1,

    I tried the changes you suggested. I changed the file extension to .php and even moved the title above the script. However, it still doesn't work.

    In IE, nothing displays.
    In Firefox, just a bunch of garbage.

    What to do?
    Here is the new page by the way:
    http://kietphan.com/localtime_test_page.php

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    How peculiar... PHP appears to be attempting to parse the ASP code. Change this:
    Code:
    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:
    Code:
    var servertimestring='<? print date("F d, Y H:i:s", time())?>';
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Mar 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Twey, that did it. Thanks a great bunch.
    Much Love and Peace, Kiet

  6. #6
    Join Date
    Mar 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi, thanks to everyone for helping. I have one more question. I want to change the font of the words and the time. I can get the letters to change, but I can't seem to get the numbers to change. Any suggestions?

    Here is the page with the new font (Verdana font size=1)
    http://kietphan.com/localtime_test_page.php

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You're off by 1pt. Since you've set the body to 8pt and the timecontainer span has no style and cannot (easily) have a <font> tag included, it is using the 8pt of the body. 7pt is very close though. You really shouldn't use the font tag anyway as it has been deprecated. In this particular case, if you set the body to 7pt and remove all font tags, you will be in business. However, pts and pixels are also poor choices for font size. % is ideal. The size you are looking for is about 60%. Now this makes for more problems though, many browser/system combos don't have Verdana available. It is a rather large font that is also more readable than most when displayed at a small size, so whatever is substituted in those situations is likely to be too small to read. At least if you do it as a percent, everybody can resize the text if they know how (IE cannot resize pts or pixels).

    I'd replace:

    HTML Code:
    <body style="font-family: Verdana; font-size: 8pt">
    
    <div><font face="Verdana" size="1">Current Server Time:</font><span id="timecontainer"></span><font face="Verdana" size="1">
    
    <script type="text/javascript">
    new showLocalTime("timecontainer", "server-php", 0, "short")
    </script></font></div>
    with:

    HTML Code:
    <body style="font-family: Verdana; font-size: 60%">
    
    <div>Current Server Time:<span id="timecontainer"></span>
    
    <script type="text/javascript">
    new showLocalTime("timecontainer", "server-php", 0, "short")
    </script></div>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    <body style="font-family: Verdana, sans-serif; font-size: 60%;">
      <div>
        <p>
          Current Server Time:<span id="timecontainer"></span>
        </p>
        <script type="text/javascript">
          new showLocalTime("timecontainer", "server-php", 0, "short")
        </script>
      </div>
    Always specify an alternative generic font family. Also, Verdana isn't a good choice if you're worried about getting font sizes right, as it's considerably larger than other fonts.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Mar 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks everyone for the great info. I like the way Verdana looks, but now I will reconsider it knowing its attributes. I will experiment with the percentage values as well.

    Cheers,
    Kiet

  10. #10
    Join Date
    Mar 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi, I am the original creator of this thread. I am trying to manage my online persona by deleting things that are related to me. I don't mind this thread existing, but I would like to remove all instances of anything that refers to me. I tried e-mailing the admin already, but I haven't gotten a reply yet. Can someone help me? I am even looking for the edit option, but it is not available.

    Any help is appreciated. Thanks.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •