FRIHOSTFORUMSSEARCHFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

This Page Was Last Modified On -------

 


NG
Simply add this code to your page:

Code:
<?
$lastmod = filemtime("EDIT.php"); //
echo("page was last modified on: ");
echo(date("m/j/y h:i", $lastmod));
?>

Be sure to edit the EDIT.PHP to the page you want to show when it was last modified.
Nyizsa
NG wrote:
Simply add this code to your page:

Code:
<?
$lastmod = filemtime("EDIT.php"); //
echo("page was last modified on: ");
echo(date("m/j/y h:i", $lastmod));
?>

Be sure to edit the EDIT.PHP to the page you want to show when it was last modified.

Or, to make it more convenient:
Code:
$lastmod = filemtime("modified");

Then, after editing the site, simply issue the touch modified command.
hexkid
Nyizsa wrote:
Or, to make it more convenient:
Code:
$lastmod = filemtime("modified");

Then, after editing the site, simply issue the touch modified command.

Or, even more convenient:
Code:
$lastmod = filemtime(__FILE__);
Nyizsa
hexkid wrote:
Or, even more convenient:
Code:
$lastmod = filemtime(__FILE__);

This works only if your site consists of one page only. If you modified, for example, the contacts.html file, which is included (or referenced) in index.php, it won't show the modification.
hexkid
Nyizsa wrote:
hexkid wrote:
Or, even more convenient:
Code:
$lastmod = filemtime(__FILE__);

This works only if your site consists of one page only. If you modified, for example, the contacts.html file, which is included (or referenced) in index.php, it won't show the modification.


Ok
What about this:
Code:
<?php // index.php
$lastmod = array();
$lastmod[] = filemtime(__FILE__);
require_once 'contacts.html'; $lastmod[] = filemtime('contacts.html');

// ...
echo 'Last modified: ', date('Y-m-d H:i:s', max($lastmod));
// ...


Your solution (update the last modified time of EDIT.php) works for the site as a whole (which might be what is needed). If you have

2006-06-21 18:19:20 index.php
2006-06-21 18:20:22 contacts.html
2006-06-21 18:21:24 menu.php
2006-06-21 18:22:26 admin.php
2006-06-21 18:22:26 EDIT.php

even URLs that do not include 'admin.php' will show last modified date as 2006-06-21 18:22:26
DanielXP
enough ripped tutorial
Related topics

FTP - file last modified date
Site Nav Suggestions...
How do I get it so a swf file doesnt cache?
HTML editing Software
Page cache/refresh question

SSI within php coded files
Server status script
how to prevent double post when user klik F5 *Refresh* ?
Ajax quiz -- 25 FRIH$
My ISP uses a Cache server, any way to force it to refresh

HOW TO: Build you own YouTube file downloader
[Solved, 9 hr] HTTPD in server2 DOWN
Google Power
Autocomplete textfield problem
Awesome javascript tricks!
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.