Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Oct 2005
    Posts
    336
    Thanks
    43
    Thanked 2 Times in 2 Posts

    Still having trouble using a timestamp to show time and date of update to my server

    Im trying to add a timestamp to my site, so whenever a page is updated to the server, the date and time of the update to the server is displayed on that page.

    I posted a question a few days ago and have been using this code which works, but the file name of each page needs to included in the code that so it will work -
    Code:
    Page was last modified on 
      <!--#config timefmt="%c" -->
      <!--#flastmod file="index.shtml" -->
    So the above code works, but its a bit of a pain because if I have 100 pages, I have to add that code to each page, and then change the 'index.shtml' part to whatever the page name I'm adding the timestamp code to is called. I can use it as an SSI, but it will only show the time of update for one individual page (eg index.shtml) across the whole site. So its not exactly what I want.

    So then I tried this code instead -
    Code:
    Page was last modified on<!--#config timefmt="%c" --><!--#echo var="DATE_LOCAL"--></p>
    This code doesnt require any file name, but if I click the refresh button in my browser it refreshes the timestamps time. So it is using my browsers time, not the time of the update/upload to the server. It does this even if I use it as an SSI also. So it is not suitable.

    So then I found some php code which works if I use a .php file name extension -
    Code:
    <?php  
    // outputs e.g.  This page was last updated on November 06 2008 14:11:22  
    
    $filename = 'php.php';  
    if (file_exists($filename)) {  
        echo "This page was last updated on " . date ("F d Y H:i:s", filemtime($filename));  
    }  
    ?>
    , but my website is using .shtml extensions because of some existing html SSI's. So the .php code wont work as an ssi with a page using .shtml.

    Can I use a .php ssi on a site which uses .shtml file names?

  • #2
    Regular Coder
    Join Date
    Sep 2008
    Location
    Oklahoma
    Posts
    249
    Thanks
    11
    Thanked 13 Times in 13 Posts
    if you need to change that many pages, i recommend using Multi Replace Its available as a non limited shareware version (never expires, nothing disabled) but your only supposed to use it for 30 days (heh) and then pay.

  • #3
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Is it not possible to replace the existing SSIs with PHP include()s? That would probably be best anyway, as you, soon enough, may want to add some server-side magic to your pages.

  • #4
    Regular Coder
    Join Date
    Oct 2005
    Posts
    336
    Thanks
    43
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by CyanLight View Post
    Is it not possible to replace the existing SSIs with PHP include()s? That would probably be best anyway, as you, soon enough, may want to add some server-side magic to your pages.
    I have never used PHP includes, are you able to explain a bit about them? I know that html ssi's use a html page with no body/head tags, and the page linked to the ssi uses the shtml extension. But I know nothing about php includes. I have only used includes so far to dislpay a navigation menu which is just an unordered list/list items housed in a div with css for styling.

    Also, if I move to php includes then obviously I will be using the .php file extension instead of shtml.
    Last edited by moss2076; 11-08-2008 at 10:18 PM.


  •  

    Posting Permissions

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