Good day to you all,
here is a question about displaying the keys of an array of files and folders, with a different color based on the last modif date, this week, this year and older....

This week = # DB1212
This year = # 003300
Older = #000000

Here are my 2 question:
1) How and where can i add in my code an code which which would add to my array a file modification time ?

2) How to display in 3 categories, or more, of font color, the file and or folder based on the file modification time ?

I know of to find file modification time but, how and where could I put it in my code:

PHP Code:

if (
file_exists($filename)) {
"$filename was last modified: " date ("F d Y H:i:s."filemtime($filename));

Here is my code:

PHP Code:


dirList ($directory)

//create 2 arrays - one for folders and one for files
$folders = array();
$files = array();

// create a handler for the directory
$handler opendir($directory);

// keep going until all files in directory have been read
while (false !== ($file readdir($handler))) {  

// if $file isn't this directory or its parent,
        // add it to the results array
if ($file != '.' && $file != '..')
// If file is directory, mark it in bold.
if(is_dir($directory.$file)) {
// Else not styled

"<ul id=\"".preg_replace('/\//','_',substr($directory,0,strlen($directory)-1))."\">\n"//start a new unordered list for every iteration through dirList

$dircor $directory;
// tidy up: close the handler
$folders as $folder) {
"<li><div class=\"folder\"><b>".$folder."</b>\n<a href=\"javascript:show('".preg_replace('/\//','_',$dircor."".$folder)."');\">Show</a>- <a href=\"javascript:hide('".preg_replace('/\//','_',$dircor."".$folder)."');\">Hide</a></div>"//echo the folder name enclosed in a list item
dirList($directory.$folder.'/'); //loop through the contents of $folder
echo "</li>\n"//close this list item after all files and folders in $folder have been looped through

$files as $file) {
$filenamecor substr($file0, -4);
"<li><a href=\"index.html\" onclick=\"load('image_view.php?dir=".$dircor."&file=".$file."','boxdisp');return false;\">".$filenamecor."</a></li>\n"//echo the file name enclosed in a list item

"</ul>\n"//close the unordered list


Thnaks !