View Single Post
Old 06-17-2009, 10:48 AM   #2 (permalink)
Salathe
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

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_ext8);
    
printf('<li><a href="minutes/%s">Minutes - %s</a></li>'$basename$date);

Salathe is offline  
Reply With Quote