Lid |
|
Beste allemaal,
Ik ben net nieuw op dit forum, ik heb een klein vraagje over mijn php script.
Ik hoop dat iemand mij hiermee kan helpen.
Ik zou willen weten op welke manier ik de mappen die ik uitlees uit een directory op datum kan sorteren.
<?php
function showfiles($map = "./", $return = array()){
if(@$dir = opendir($map)){
while (false !== ($file = readdir($dir))){
if ($file != "." && $file != ".."){
$return[] = $map . $file;
}
}
}
@closedir($dir);
return $return;
}
if(isset($_GET['map'])){
$return2 = showfiles('media/fotos/'.$_GET['map'].'/');
echo '
<div id="top_content"></div>
<div id="middle_content">
<div id="content">
<div id="page-wrap">
<H1>'.$_GET['map'].'</H1><br/> <center>
<div class="gallery clearfix">
';
//bugfix
//echo '<pre>';
//print_r($return2);
//echo '</pre>';
for($i = 0; $i < count($return2);$i++){
$name = explode("/", $return2[$i]);
if($name[3] != 'thumb'){
$dest = $name[0].'/'.$name[1].'/'.$name[2].'/thumb/'.$name[3];
$name = explode(".", $name[2]);
$empty = false;
echo '<div id="fotobook_border"><a href="'.$return2[$i].'" class="mustang-gallery" rel="prettyPhoto[gallery1]" title="'.$name[0].'"><img src="'.$dest.'" border="0" width="100" height="100" alt="'.$name[0].'" /></a></div>
';
}
}
if(!isset($empty)){
echo '<div class="font">Dit album is nog leeg.</div>';
}
echo '</div></div>
<div class="clear"></div><div id="lid_worden"><a href="/jaz/#sectionFotoalbum">Ga terug</a></div>
</div> </div>
<div id="bottom_content"></div>
';
}
else{
if ($handle = opendir('media/fotos/')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo '<table border="0">';
$kleur2 = "<tr class='odd'>";
if(isset($kleur)){
echo $kleur;
unset($kleur);
}
else{
$kleur = '<tr>';
echo $kleur2;
}
echo '<td VALIGN="top" ALIGN="left" BORDER="0">';
echo "<div class=\"font\"><a href=\"?map=$file\" class=\"album-link\" TARGET=\"_top\">$file\n</a></div>";
echo "</td><td VALIGN=\"top\" ALIGN=\"right\"><a href=\"?map=$file\" TARGET=\"_top\"/><img alt=\"Bekijk\" border=\"0\" value=\"Bekijk\" src=\"images/view.png\" >
</a></td></tr>";
} echo '</table>';
}
}
closedir($handle);
}
?>
<?php function showfiles ($map = "./", $return = array()){ while (false !== ($file = readdir($dir))){ if ($file != "." && $file != ".."){ $return[] = $map . $file; } } } return $return; } $return2 = showfiles('media/fotos/'.$_GET['map'].'/'); <div id="top_content"></div> <div id="middle_content"> <div id="content"> <div id="page-wrap"> <H1>'.$_GET['map'].'</H1><br/> <center> <div class="gallery clearfix"> '; //bugfix //echo '<pre>'; //print_r($return2); //echo '</pre>'; for($i = 0; $i < count($return2);$i++){ $name = explode("/", $return2[$i]); if($name[3] != 'thumb'){ $dest = $name[0].'/'.$name[1].'/'.$name[2].'/thumb/'.$name[3]; $empty = false; echo '<div id="fotobook_border"><a href="'.$return2[$i].'" class="mustang-gallery" rel="prettyPhoto[gallery1]" title="'.$name[0].'"><img src="'.$dest.'" border="0" width="100" height="100" alt="'.$name[0].'" /></a></div> '; } } echo '<div class="font">Dit album is nog leeg.</div>'; } <div class="clear"></div><div id="lid_worden"><a href="/jaz/#sectionFotoalbum">Ga terug</a></div> </div> </div> <div id="bottom_content"></div> '; } else{ if ($handle = opendir('media/fotos/')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo '<table border="0">'; $kleur2 = "<tr class='odd'>"; } else{ $kleur = '<tr>'; } echo '<td VALIGN="top" ALIGN="left" BORDER="0">'; echo "<div class=\"font\"><a href=\"?map=$file\" class=\"album-link\" TARGET=\"_top\">$file\n</a></div>"; echo "</td><td VALIGN=\"top\" ALIGN=\"right\"><a href=\"?map=$file\" TARGET=\"_top\"/><img alt=\"Bekijk\" border=\"0\" value=\"Bekijk\" src=\"images/view.png\" > </a></td></tr>"; } } } ?>
Met vriendelijke groet,
jackwood
|