Results 1 to 4 of 4

Thread: Local Time Script, PHP vs. SSI

  1. #1
    Join Date
    Oct 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Local Time Script, PHP vs. SSI

    Hello,

    I have a question about your Local Time script
    http://www.dynamicdrive.com/dynamicindex6/localtime.htm

    Your instructions say to insert this code in the Body:

    Code:
    Current Server Time:<span id="timecontainer"></span>
    <script type="text/javascript">
        new showLocalTime("timecontainer", "server-ssi", 0, "short")
    </script>
    … with servermode set to "server-php", "server-asp", or "server-ssi".

    My ISP supports PHP but not SSI. So, my body text would be:

    Code:
    Current Server Time:<span id="timecontainer"></span>
    <script type="text/javascript">
        new showLocalTime("timecontainer", "server-php", 0, "short")
    </script>
    But, in the header code is this line:

    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() %>'
    I see servermode referenced twice here, indicating both php and ssi.

    Here is my question: to invoke PHP, do I need to edit this as well?

    Also, I am a bit confused why both protocols are referenced in the same line. (Pardon me if I am showing my ignorance here; I come by it naturally).

    Thank you for your time and consideration.

    Scott Eveland
    Last edited by keyboard; 10-24-2012 at 09:33 PM. Reason: Format: Code Tags [code][/code]

  2. #2
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    It's fine, the code is actually using the ternary operator:
    PHP Code:
    ? : 
    It's basically a conditional statement, so if it's php it does some code, otherwise do the ssi code.
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Test out the script. It should work. It's set up to try to do PHP, SSI and ASP, in that order.
    In some sense you might want to actually edit the line to only include the particular language you want (in this case PHP) but having the others won't hurt anything.
    You should be able to leave it as is and have it work. Check that and let us know if it's not working.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    The only problem with modifying it as far as I can see, is that if you switch to using one of the other Languages, it will cease to work entirely.
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

Similar Threads

  1. Local Time Script - Time Format
    By MizzBia in forum Dynamic Drive scripts help
    Replies: 8
    Last Post: 06-20-2011, 12:37 PM
  2. Local Time script not displaying time at all
    By kittiekat in forum Dynamic Drive scripts help
    Replies: 6
    Last Post: 01-26-2010, 02:46 AM
  3. Local Time script
    By Bushido27 in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 07-13-2007, 07:37 PM
  4. Local Time script
    By chas in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 01-25-2007, 05:20 AM
  5. Local Time Script - Military time?
    By ebrad in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 11-23-2005, 08:08 PM

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
  •