Via open artifact cam this link to MovableBlog’s Integrating del.icio.us with PHP and Magpie describing a way to embed the output of your del.icio.us links in a web page. As always, there are many paths to the same destination.

As frequent readers know, this can be achieved via the JavaScript approach using our Feed2JS service or standalone code. Of course there is a round trip delay for this as a PHP script must be called which then fetches a fresh feed from the source (or loads a cached one). Or maybe JavaScript is just too clumsy for your tastes,

If you are on a PHP capable server, you can install Magie (which you need to do with the approach described via MovableBlog), but if you also use our PHP version of Feed2JS you can achieve the same effect.

The advantage of our approach over the one described above is that it can be repeated quite easily just by creating new shorter series of include statements. For example, below I will use it with my del.ici.ous RSS feed, but 3 weeks ago I used a different set of parameters to the same code. Feed, Rinse, Repeat.

All I need to make a feed here is to use

which gives us…

< ?php // declare Feed2Js variables $src = 'http://del.icio.us/rss/cogdog'; $chan = 'y'; $num = 10; $desc = 1; $date = 'y'; $targ = 'y'; // include the feed2php include file include '/var/www/html/feed/feed2php.inc'; ?>

And I can just as easily add another just as quickly, say may furl feed to the same page:

which gives us…

< ?php // declare Feed2Js variables $src = 'http://www.furl.net/members/cogdog/rss.xml'; $chan = 'y'; $num = 10; $desc = 1; $date = 'y'; $targ = 'y'; // include the feed2php include file include '/var/www/html/feed/feed2php.inc'; ?>

The post "Tasty del.icio.us feeds with PHP" was originally squeezed out of the bottom of an old rusted tube of toothpaste at CogDogBlog (http://cogdogblog.com/2004/11/tasty-delicious/) on November 19, 2004.

7 Comments

  • Alan – When I view the source of your feed2js created page, I am abale to see the HTML source. When I view the source of my feed2js created page, all I see is the SCRIPT tag – I don’t see the result of the processing. What gives?

  • Alan Levine

    Because the examples above are not generated by the JavaScript approach (which echos a series of document.write commands returned as a .js source file) but by direct include of php statements which output raw HTML to the page.

  • After I did a little more looking, that’s what I figured, Alan. You’re using the .inc file.

    Before I dig further: have you, or anyone, come up with a working method to include the .inc calls across a http request? To include the feeds in WebCT or Blackboard (servers not supporting PHP directly), we’ll need to pass the requests to another PHP-friendly server.

    I ask, as the Javascript version is not 508 accessible. The PHP .inc results can be. We need a way to fully write the contents of a feed back to a page that resides on a server not supporting PHP.

  • Roch Smith

    Wow! Wow! Wow!

    Alan, your Feed2js is supurb! I installed the stand alone on my server, following your clear instructions precisely and it works like a charm! Bravo!

    One question though, what is the best way to include multiple feeds? Should I initiate a new script for each, or can I place multiple feeds within one instance of the javascript?

    Thanks again. You’re brilliant.

  • Alan Levine

    I cannot see an easy way to include dynamic content into such pages– you may have to look at something like server side includes which would require writing something completely new to do the parsing and dispaly of RSS content.

    However, I am not sure about the statement of not being 508 compliant. The JavaScript is ignored, but Feed2JS includes a NOSCRIPT tag that links to an HTML generated version of the feed (thus not embedded in the page, but still available to the user).

    Try turning off JS in your browser to see how it works.

  • Alan Levine

    Roch,

    Thanks- multiple insertions of feeds would require a separate Feed@JS chunk of cod eper page. This could be a hit on your time to load pages;l I have done as many as 3 and there is a lag for the content to load. Your mileage may vary.

    If your server runs PHP, however, you can speed it up a bit by using the method described in this post, which has 2 different sets of feeds on the same page.

  • Bruce Landon's Weblog for Students radio.weblogs.com/0101747/2004/11/19.html#a5006

    blog tech

    Tasty del.icio.us feeds with PHP .