I’ve started using Ma.gnolia for managing bookmarks, I like their Mini Ma.rker bookmarklet. It makes for a pretty nice way to bookmark, tag and add a brief description. I was thinking I could use Ma.gnolia as a way to share items similar to Facebook shares with the NY Times, but with Ma.gnolia I can do it for any site.
Ma.gnolia has numerous feeds which makes it pretty easy. They provide a very simple way of doing a link roll with a single javascript embed. I’m using the JSON feed because I want to limit to only four bookmarks to display. Here’s the code I’m using to display the My Shared News in the right column.
</script>
<script type=”text/javascript”>
var c = 0;
for (i=0; i < Magnolia.bookmarks.length; i++) {
if (c < 4) {
document.write(’<li><a href=”‘+Magnolia.bookmarks[i].url+’”>’);
document.write(Magnolia.bookmarks[i].title+’</a><br/>’);
document.write(Magnolia.bookmarks[i].description+’</li>’);
c = c + 1;
}
}
</script>
I actually run a cronjob which periodically fetches the JSON file and writes it locally; so load time isn’t reliant on Ma.gnolia’s site. I was initially using one of their XML feeds parsing and writing to a database, but using JSON and javascript I don’t need a database or PHP. It is possible to let the browser do all the work.
Comments 3
Hey Marcus
Posted 05 Mar 2007 at 12:35 pm ¶This is a great use of the JSON feeds. The decision to put some caching in place so that your page load time isn’t tied to how busy we might be is a perfect example of how to put open APIs to work, and getting around the need for a database and PHP is pretty sweet. Thanks for sharing this, and the code!
Wow, this is very cool, great work Marcus! This provides a super-simple way for people to get rolling with Ma.gnolia.
Posted 06 Mar 2007 at 6:07 am ¶Awesome script, Marcus, thanks a lot.
I was hoping to use Alex’s excellent Magnolia Wordpress Plugin, but my host’s PHP doesn’t support fopen(), which is used by LastRSS, a dependency of Alex’s otherwise awesome script. This little snippet saved me a lot of work!
Posted 13 Sep 2007 at 3:31 pm ¶Post a Comment