View Full Version : last update
weronpc
06-12-2003, 01:22 AM
Do anyone know how to use php to out put last update?
I want to use php to keep track of each time I update my page (each time I save my page).
is it posible?
Thank you
Jason
06-12-2003, 01:29 AM
do you mean refresh the page or you mean update some data or do you mean update the code?
Jason
If in updates.txt, you have lines like this:
January 2nd, 2000 - Updated layout again
January 1st, 2000 - Updated layout
I think you could do this:
// Open/Read/Close Updates File
$fp_name = "updates.txt";
$fp = fopen($sp_name, "r");
$content = fread($fp, filesize($fp_name));
fclose($fp);
// Split it into an array
$update = preg_split('#\n#', $content);
// Print Latest Update
echo update[0];
weronpc
06-12-2003, 04:36 PM
Thanx for your reply,
but.....
Have you ever go to a page that at the bottom says
Last update : dd/mm/yyyy
or
Last modify : dd/mm/yyyy
I want to post out the date for the latest change of the page.
If I change some code for page home.php
the date will automatically updated to the day I saved the changes. So, when people visit home.php, they can tell is there any new stuff by looking at the last update.
*thinks a bit*
echo 'Last update : ' . date ('d/m/Y', filemtime($PATH_TRANSLATED));
weronpc
06-13-2003, 04:19 PM
I am new to php stuff,
I don't understand...
what is date ('d/m/Y', filemtime($PATH_TRANSLATED))
Thanx :o
missing-score
06-13-2003, 04:39 PM
d/m/Y:
are letters used bye the date() function to create output data...
so: d = day, m = month, Y = year
date("m, d - Y")
would create: month, day - year
weronpc
06-13-2003, 05:22 PM
what about filemtime($PATH_TRANSLATED)
missing-score
06-13-2003, 08:19 PM
filetime() is a function to get the last save time...
I dunno what $PATH_TRANSLATED is.... never seen it used before...
weronpc
06-14-2003, 06:27 AM
I went to php.net and this works for me
$s = filectime($_SERVER['DOCUMENT_ROOT'].$_SERVER['PHP_SELF']);
$chg = date("F j, Y", $s);
echo "Last update: ".$chg;
sorry about that, $PATH_TRANSLATED is simply another way of accessing $_SERVER["PATH_TRANSLATED"]
$_SERVER["PATH_TRANSLATED"]
Filesystem- (not document root-) based path to the current script, after the server has done any virtual-to-real mapping.
Note that filmctime() will not have the desired result you are looking for (from what I can gather from your posts).
filemtime() is what you want to use when you want to create "Last Modified" footers on web pages.
weronpc
06-15-2003, 05:51 PM
Thanx,
now it's much better...
:)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.