06-17-2009, 11:48 AM
|
#2 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,324
Thanks: 5
|
It's a totally different approach to your script, but I think the following is much cleaner.
PHP Code:
$path = 'path/to/files';
$files = glob($path.'/Minutes *.doc');
foreach ($files as $file)
{
// Minutes 1-2-2003.doc
$basename = basename($file);
// Minutes 1-2-2003
$no_ext = basename($basename, '.doc');
// 1-2-2003
$date = substr($no_ext, 8);
printf('<li><a href="minutes/%s">Minutes - %s</a></li>', $basename, $date);
}
|
|
|
|