BellaBuffs: Sorting Affiliates by Title
Requested from Kate » at the TFL Boards »; I was rather hard-up to accomplish this, even after 10 tries, but I did it, and it's shiny!
Snippet
In affiliates.php, go to line 9, and underneath this line:
$array = file(AFFILIATES);
Add the following code RIGHT underneath that:
$sort = array();
foreach ($array as $row) {
list($aButton, $aName, $aEmail, $aURL, $aSitename) = preg_split("/,(?! )/", $row);
$sort[] = $aName;
}
array_multisort($sort, SORT_ASC, $array);
The whole block of text will look like this:
$array = file(AFFILIATES);
$sort = array();
foreach ($array as $row) {
list($aButton, $aName, $aEmail, $aURL, $aSitename) = preg_split("/,(?! )/", $row);
$sort[] = $aName;
}
array_multisort($sort, SORT_ASC, $array);
Snazzy, eh? Hit the » download page if you're uncomfortable messing with the code!
Comments
Currently no comments!