iamregistered
Programmer
Greetings all,
I have a directory containing following files
Test.rar
Test.txt
Test.jpg
Body.rar
Body.txt
What I am trying to do is read these files ad them to an array, sort it by name and then printing it onto a table in a smiliar way to this:
However, I am able to create the arry and sort it. Also I can print out them in correct order, but my problem lies in a correct output to the table.
This is the code I am currently using.
Thansk for any help!
/Martin
**
En solnedgång här
Med björkens dalande löv
Mörkret närmar sig
**
I have a directory containing following files
Test.rar
Test.txt
Test.jpg
Body.rar
Body.txt
What I am trying to do is read these files ad them to an array, sort it by name and then printing it onto a table in a smiliar way to this:
Code:
<tr>
<td>test.rar</td>
<td>test.txt</td>
<td>test.jpg</td>
</tr>
<tr>
<td>body.rar</td>
<td>body.txt</td>
<td>null</td>
</tr>
However, I am able to create the arry and sort it. Also I can print out them in correct order, but my problem lies in a correct output to the table.
This is the code I am currently using.
Code:
if( is_dir( $path ) )
{
$handle = opendir( $path );
while( $file = readdir( $handle ) )
{
if( $file != "." && $file != ".." )
{
$file_parts = pathInfos($path.$file);
/*pathInfos retrievs filename (file), dir name(root/folder/),basename(file.ext) and extensio(ext) */
$map[$file_parts['basename']] = $file_parts['filename'];
}
}
closedir( $handle );
}
foreach( $map as $val )
{
$val = str_replace( "_"," ",$val);
echo $val."<br>";
}
Thansk for any help!
/Martin
**
En solnedgång här
Med björkens dalande löv
Mörkret närmar sig
**