Alphabetically Sorted del.icio.us Feeds

The del.icio.us site is a good way to create and share bookmarks, but the sorting is limited to the date and time that the links was added. Fortunately the PHP array_multisort function (see Example 3 on the linked page) can be used to sort a del.icio.us RSS feed imported using MagpieRSS.

The following code seems to work:

function sort_by_title($big_rss_array)
{
foreach ($big_rss_array as $key => $row) {
$rss_title[$key] = $row['title'];
}
array_multisort($rss_title, SORT_ASC, SORT_STRING, $big_rss_array);
return $big_rss_array;
}

$rss_sorted = sort_by_title($rss->items);

The multi-dimensional array $rss->items has all the goodies for the Magpie-parsed feed. Call the function and then use $rss_sorted in place of $rss->items when generating links from the feed.

Here’s an example of the above code added to a feed2js page: http://kermitmurray.com/kkmurray_delicious.html.

Word of caution: I don’t know much PHP programming; the above was extrapolated from a basic knowledge of Fortran77 and “seat-of-the-pants” HTML.