You are here: Documentation » Tips, Tricks, Tutorials, and Screencasts » How to replicate PopURLs (aka Newsblocks Demo)
How to replicate PopURLs (aka Newsblocks Demo)
Recently, websites like PopURLs, TheWebList, Miniboxs, and Original Signal have become all the rage. Generally, these sites consist of multiple feeds – each it it's own block on the page. These sites typically consist of a relatively wide range of topics from news to media to technology to whatever else.
This tutorial assumes that you're already familiar with using SimplePie, including looping through items.
Compatibility
- Supported in SimplePie 1.0.
- Code in this tutorial should be compatible with PHP 4.3 or newer, and should not use PHP short tags, in order to support the largest number of PHP installations.
Code source
We're going to create a simplified clone of these kinds of sites that we're calling “Newsblocks”. This demo leverages the entire front-end development stack (XHTML, CSS, JavaScript, PHP) and utilizes the Prototype, Scriptaculous and Behaviour JavaScript libraries. You'll need to make sure the enclosed cache directory is writable, and you should copy the latest version of simplepie.inc into the enclosed php directory.
We've created this demo properly by separating types of code from each other, and we've included an .htaccess file along with a small PHP document that will gzip-compress the JavaScript libraries before serving them to the browser. This demo includes the latest versions of the aforementioned libraries, including a version of Behaviour which was modified to utilize the built-in Prototype functionality instead if duplicating it.
New in version 1.1: If you're upgrading from Newsblocks 1.0, you'll need to do some minor updates to your code. Look at the contents of index.php see how parameters are passed in this version (as an associative array). You should also read the code comments inside newsblocks.inc, as that's where the option details are contained. Now supports multifeeds, custom titles, custom favicons, new way of setting options, fancy CSS/JavaScript description tooltips, and description shortening.
New in version 1.1.1: Added support for the permalink option in the render() function.
Besides being relatively simple, the organization, code, and methods used in the demo below should be production-ready.
tutorial/how_to_replicate_popurls.txt · Last modified: 2007/11/26 21:44 by admin

