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!

Add Comment

Details

* Comment:

Anti-SPAM


CAPTCHA Image

Submit

Log Comment?
("Log Comment" can only apply to those who have an account here at ; if you do, make sure you use the same Name and E-Mail your account uses.)

Twitter Feed »

  • New Blog Post: Listing Admin: Important Bugfix: http://ow.ly/2pWwa August 15th, 2010
  • New Blog Post: Call for Beta Testers (and a Tiny-Little-Note)!: http://ow.ly/25sVx June 30th, 2010
  • New Blog Post: Listing Admin 2.2: http://ow.ly/1XJSd June 12th, 2010