arbitter Posted March 27, 2010 Share Posted March 27, 2010 I want to display all directorys; the file is in a folder, let's say folder A. In folder A, theres the directory 'fotos' In that directory are years, as '2010' in that folder, there are months 'January' For each month of each year, I want a table line. The problem is that with what I have now, I get all the folders from in 2010, but then when I loop I get all the folders from 2010 again and then the folders from 2011. $diryear = GLOB('fotos/*', GLOB_ONLYDIR); foreach($diryear as $diryears){ $dirmonth = GLOB($diryears . '/*', GLOB_ONLYDIR); foreach($dirmonth as $dirmonthh){ $dirsorted[filemtime($dirmonthh)] = $dirmonthh; } ksort($dirsorted); foreach($dirsorted as $dirmonths){ $dirmonthss = urlencode($dirmonths); $stuk = explode('/',$dirmonths); echo "<tr><td align='center' style='cursor:pointer' colspan='2' bgcolor='white' onclick=\"location.href='index.php?module=fotos&dir=$dirmonthss'\">$stuk[2] $stuk[1]</td></tr>"; } } Link to comment https://forums.phpfreaks.com/topic/196690-problem-with-some-foreach-and-some-glob/ Share on other sites More sharing options...
arbitter Posted March 28, 2010 Author Share Posted March 28, 2010 anyone any help here? Link to comment https://forums.phpfreaks.com/topic/196690-problem-with-some-foreach-and-some-glob/#findComment-1032947 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.