...

View Full Version : Still having trouble using a timestamp to show time and date of update to my server



moss2076
11-08-2008, 09:10 PM
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 -


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 -


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 -

<?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?

owt200x
11-08-2008, 09:36 PM
if you need to change that many pages, i recommend using Multi Replace (http://www.cict.co.uk/software/dev/mrep.htm) 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.

Apostropartheid
11-08-2008, 09:39 PM
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.

moss2076
11-08-2008, 11:12 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum