Código PHP:
<?php
//
// Ready to display folders and files.
//
$row = 1;
//
// Folders first
//
if($dirs)
{
foreach ($dirs as $a_dir)
{
$row_style = ($row ? "one" : "two");
?>
<tr class="row <?php echo $row_style; ?>">
<td colspan="3" class="long">
<?php echo "<a href=\"?dir=".$dir."/".$a_dir."\">".$a_dir."</a>"; ?>
</td>
</tr>
<?php
$row =! $row;
}
}
//
// Now the files
//
if($files)
{
foreach ($files as $a_file)
{
$row_style = ($row ? "one" : "two");
?>
<tr class="row <?php echo $row_style; ?>">
<td class="name">
<?php
print " <a href=\"".$dir."/".$a_file["name"]."\"";
if($open_in_new_window)
print "target=\"_blank\"";
print ">".$a_file["name"]."</a>";
$row =! $row;
}
}
//
// The files and folders have been displayed
//
?>