Sort folders by date
Posted: Sun Feb 18, 2007 5:22 pm
feyd | Please use
Is there anything there that can be altered to sort the list into date order, rather than alphabetical? I apologise if it is obvious, i am a novice when it comes to php.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I'm using the 'onepage' gallery on my site, which adds images into the gallery based on what has been uploaded to a specific folder on my server. Inside the folder, i create subfolders and 'onepage' makes these into the categories by which my gallery images are displayed.
For instance "images/Christmas_2006" appears in the gallery as a category called "Christmas 2006"
I have successfully integrated it into my site, but there is one problem. The categories are sorted in alphabetical order, and i really would like them to be sorted by date, with the most recent gallery at the top of the list.
I think this is the code that affects the list:Code: Select all
if($hv == 1) {
$br = "<br>";
$s = "•";
$t = "";
foreach($ff as $long => $dir) {
$dirName = str_replace ("_", " ", $dir);
list($file, $else) = explode('?', $dest);
$tekst = "<a href= $file?odabir=$dir class='tekst'>$s $dirName $newLine</a>";
echo $tekst;
echo $br;
}
} else {
$countFolders = count($ff);
$br = "";
$s = "•";
$t = "•";
$lll = 0;
foreach($ff as $long => $dir) {
if($long+1 == $longName+$lll && $long != $countFolders-1) {
$newLine = "$t<br>";
$lll = $lll+$longName;
}else {
$newLine = "";
}
$dirName = str_replace ("_", " ", $dir);
list($file, $else) = explode('?', $dest);
$tekst = "<a href= $file?odabir=$dir class='tekst'>$s $dirName $newLine</a>";echo $tekst; echo $br;
}
}Is there anything there that can be altered to sort the list into date order, rather than alphabetical? I apologise if it is obvious, i am a novice when it comes to php.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]