Hi,
I solved this using the following snippet:
<?php
include $modx->config['base_path']."assets/snippets/preg_find/preg_find.php";
( isset($rss) ) ? $rss : $rss = 0;
if ($rss==0) {
$files = preg_find('/./', 'assets/files',
PREG_FIND_RECURSIVE|PREG_FIND_RETURNASSOC|PREG_FIND_SORTMODIFIED|PREG_FIND_SORTDESC);
$i=1;
echo "<table>";
echo"<tr><td><b>Datum</b></td><td><b>Plaats</b></td><td><b>Bestandsnaam</b></td></tr>";
foreach($files as $file => $stats) {
$path_parts = pathinfo($file);
$var = explode('/', $file);
$groep ="/leerlingen/".$var[2];
printf('<tr><td>%d) %s</td><td>%s</td><td><a href="%s">%s.%s</a></td></tr>', $i,
date('d-m-Y', $stats['stat']['mtime']),$var[2], $file, $path_parts['filename'],$path_parts['extension']);
$i++;
if ($i >10) break;
}
echo "</table>";
}
else {
echo '<?xml version="1.0" encoding="'.$modx->config['modx_charset'].'" ?>';
echo '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">';
echo '</rss>';
}
?>
This uses code from
http://www.pgregg.com/forums/viewtopic.php?tid=73 (the include ...preg_find.php). The line
$files = preg_find('/./', 'assets/files',
PREG_FIND_RECURSIVE|PREG_FIND_RETURNASSOC|PREG_FIND_SORTMODIFIED|PREG_FIND_SORTDESC);
returns an array with all files, sorted on modified date, exactly what I needed!
As you can see, I’m in the midst of adding an xml feed to this snippet, so the my visitors can subscribe to this list. Not finished yet, as I have zero time to dedicate to this...