{"id":541,"date":"2005-05-01T19:27:00","date_gmt":"2005-05-01T19:27:00","guid":{"rendered":"http:\/\/kermitmurray.com\/blog\/?p=541"},"modified":"2013-01-21T22:34:22","modified_gmt":"2013-01-22T04:34:22","slug":"alphabetically-sorted-del-icio-us-feeds","status":"publish","type":"post","link":"https:\/\/kermitmurray.com\/blog\/alphabetically-sorted-del-icio-us-feeds\/","title":{"rendered":"Alphabetically Sorted del.icio.us Feeds"},"content":{"rendered":"<p>The <a href=\"http:\/\/del.icio.us\/\">del.icio.us<\/a> 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 <a href=\"http:\/\/us3.php.net\/manual\/en\/function.array-multisort.php\">array_multisort<\/a> function (see Example 3 on the linked page) can be used to sort a <a href=\"http:\/\/del.icio.us\/\">del.icio.us<\/a> RSS feed imported using <a href=\"http:\/\/magpierss.sourceforge.net\/\">MagpieRSS<\/a>.<\/p>\n<p>The following code seems to work:<code><\/p>\n<p> function sort_by_title($big_rss_array)<br \/>  {<br \/> foreach ($big_rss_array as $key => $row) {<br \/>   $rss_title[$key] = $row['title'];  <br \/>  }<br \/> array_multisort($rss_title, SORT_ASC, SORT_STRING, $big_rss_array);<br \/> return $big_rss_array;<br \/>  }<\/p>\n<p> $rss_sorted = sort_by_title($rss->items);<\/p>\n<p><\/code>The multi-dimensional array <cite>$rss->items<\/cite> has all the goodies for the Magpie-parsed feed. Call the function and then use <cite> $rss_sorted<\/cite> in place of <cite>$rss->items<\/cite> when generating links from the feed.<\/p>\n<p>Here&#8217;s an example of the above code added to <a href=\"http:\/\/jade.mcli.dist.maricopa.edu\/feed\/\">a feed2js<\/a> page: <a href=\"http:\/\/kermitmurray.com\/kkmurray_delicious.html\">http:\/\/kermitmurray.com\/kkmurray_delicious.html<\/a>. <\/p>\n<p>Word of caution:  I don&#8217;t know much PHP programming; the above was extrapolated from a basic knowledge of <a href=\"http:\/\/www.star.le.ac.uk\/~cgp\/prof77.html\">Fortran77<\/a> and &#8220;seat-of-the-pants&#8221; HTML.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/kermitmurray.com\/blog\/alphabetically-sorted-del-icio-us-feeds\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Alphabetically Sorted del.icio.us Feeds&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[98],"class_list":["post-541","post","type-post","status-publish","format-standard","hentry","category-web","tag-web","entry"],"_links":{"self":[{"href":"https:\/\/kermitmurray.com\/blog\/wp-json\/wp\/v2\/posts\/541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kermitmurray.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kermitmurray.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kermitmurray.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kermitmurray.com\/blog\/wp-json\/wp\/v2\/comments?post=541"}],"version-history":[{"count":1,"href":"https:\/\/kermitmurray.com\/blog\/wp-json\/wp\/v2\/posts\/541\/revisions"}],"predecessor-version":[{"id":1624,"href":"https:\/\/kermitmurray.com\/blog\/wp-json\/wp\/v2\/posts\/541\/revisions\/1624"}],"wp:attachment":[{"href":"https:\/\/kermitmurray.com\/blog\/wp-json\/wp\/v2\/media?parent=541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kermitmurray.com\/blog\/wp-json\/wp\/v2\/categories?post=541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kermitmurray.com\/blog\/wp-json\/wp\/v2\/tags?post=541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}