arbitter Posted January 21, 2010 Share Posted January 21, 2010 I've got huge issues with this small (probably basic for you guys) script. <?php $dirs = glob('*',GLOB_ONLYDIR|GLOB_NOSORT); foreach($dirs as $dir) { $sortedDirs[filemtime($dir)] = $dir; } ksort($sortedDirs); foreach (($sortedDirs) as $map) { $qmap = urlencode($map); echo "<tr><td colspan='2' bgcolor='white' width='200' align='center' valign='top' style='cursor:pointer;cursor:hand' onclick=\"location.href='?month=$qmap&sort='\"><center>$map</td></tr>"; } $month = $_GET["month"]; echo "<tr colspan='2' height='*'><td> </td></tr><tr><td colspan='2'><b><center>Sorteren op:</center></b></td></tr> <tr valign='bottom'><td bgcolor='white' width='200' align='center' valign='bottom' style='cursor:pointer;cursor:hand' onclick=\"location.href='?month=$qmap&sort=ksort'\"><center>Oudste</td> <td bgcolor='white' width='200' align='center' valign='bottom' style='cursor:pointer;cursor:hand' onclick=\"location.href='?month=$qmap&sort=krsort'\"><center>nieuwste</td></tr>"; ?> $sort = $_GET["sort"]; if (isset($month)){ $images = glob($month . '/*.{jpg,gif,jpeg,pjpeg,image,JPEG}', GLOB_BRACE|GLOB_NOSORT); if (isset($images)){ foreach ($images as $image) {$sortedimages[filemtime($image)] = $image; } if ($sort == 'ksort'){ ksort($sortedimages); foreach (($sortedimages) as $afbeelding) { echo "</br><center><img src=\"$afbeelding\" style=\"max-width: 60%\"></br>";}} elseif($sort == 'krsort'){ krsort($sortedimages); foreach (($sortedimages) as $afbeelding) { echo "</br><center><img src=\"$afbeelding\" style=\"max-width: 60%\"></br>";}} else{echo " ";}}} What I want to do, is that there's a whole list, created with foreach(), of months, and if you click on them, the pictures in that map display. Then, you can click on a button to change the sorting of those pictures, that are open at that moment. I can't find anything wrong witht the script, though it doesn't work. Now it doesn't even display the pictures. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.