I want to create a list the names of the files which have been last modified at
http://www.searchr.us/web-search/
I want to show these file names on my Homepage and they should change according to the last modified files !!
I want to create a list the names of the files which have been last modified at
http://www.searchr.us/web-search/
I want to show these file names on my Homepage and they should change according to the last modified files !!
You can use this function
function listdir_by_date($path){
$dir = opendir($path);
$list = array();
while($file = readdir($dir)){
if ($file != '.' and $file != '..'){
// add the filename, to be sure not to
// overwrite a array key
$mtime = filemtime($data_path . $file) . ',' . $file;
$list[$mtime] = $file;
}
}
closedir($dir);
krsort($list);
return $list;}
You can then loop through $list and echo accordingly.
Basically You can use the filemtime() function described here.