Warwick Blogs Grabber
This is a project I created many years ago, and haven't touched in about 11 to 14 years. It's mainly here for posterity, but if you still find it useful (and if it still works) then by all means feel free to make use of it. Any references to "6 times 9" are because that is the retired website where I was previously hosting things like this.
Warwick Blogs Grabber is a PHP script I wrote to grab and process the RSS feed for my Warwick University blog so I could display it on my website at the time, and thanks to the flexibility of Warwick Blogs' RSS feeds the number of entries shown is customisable.
Because the "Title" in all the RSS feeds is always the main title of the blog, the page title can be manually set if the feed is not the main feed (the feed for a tag, for example).
The author of an entry is not output by default, however it is extracted from the feed. If the author is required (for multi-user blogs, for example) then the appropriate code can be easily added or a "custom" display used (see below).
Since RSS is theoretically a standard, WBG should work with non-Warwick-Blogs feeds but may need some tweaking.
There are four display options: normal, list, raw, and custom. "Normal" presents the page as you would expect a blog to appear, and "Custom" reads the RSS feed but doesn't output anything so you can structure it however you like.
"List" and "Raw" are demonstrated below; note that "Raw" is not intended to be a valid PHP array; it is merely a means of presenting the structure of the data, and is useful if you ultimately want to use a custom display.
The default of the 10 most recent posts, presented as a bulleted list.
- Not to blow my own party blower... - 10 Nov 2008
- Google App Engine is quite easy to use - 26 Jun 2008
- Parking Fail - 25 Jun 2008
- Hmmm... that's disappointing - 18 Jun 2008
- It's Firefox 3 Download Day - 17 Jun 2008
- There's this Nigerian prince I know that needs to get some money out of the country... - 16 Jun 2008
- Up Up Down Down Left Right Left Right B A - 15 Jun 2008
- It would be nice if Gmail could tell me itself... - 15 Jun 2008
- I restarted about 10 times, but I got there in the end... - 14 Jun 2008
- I have more spam than emails... - 13 Jun 2008
The most recent post, presented as the structure of the generated array.
$blogentries=array( Not to blow my own party blower... - 1 => array( title => Not to blow my own party blower..., link => https://blogs.warwick.ac.uk/richardwinskill/entry/not_to_blow/, desc => <p class="answer">Follow-up to <a href="https://blogs.warwick.ac.uk/richardwinskill/entry/for_its_a/" title="Related blog entry">For It's a Jolly Good Fellow</a> from <a href="https://blogs.warwick.ac.uk/richardwinskill">The randomness of tomorrow, today!</a></p><p>I know I say this every year, but Happy Birthday <em>The randomness of tomorrow, today!</em>!</p><p>Gosh. Four years old today. My how the time flies... </p>, tags => <a href="https://blogs.warwick.ac.uk/richardwinskill/tag/4/" rel="tag" title="Entries tagged with "4"">#4</a> <a href="https://blogs.warwick.ac.uk/richardwinskill/tag/birthday/" rel="tag" title="Entries tagged with "Birthday"">#Birthday</a> <a href="https://blogs.warwick.ac.uk/richardwinskill/tag/blog/" rel="tag" title="Entries tagged with "Blog"">#Blog</a> <a href="https://blogs.warwick.ac.uk/richardwinskill/tag/randomness/" rel="tag" title="Entries tagged with "Randomness"">#Randomness</a>, time => 1226340009, commenturl => https://blogs.warwick.ac.uk/richardwinskill/entry/not_to_blow/#comments, guid => 094d73991623baf101162bd777b7056b, commentnum => 2 Comments, ), );
Since the processing of the feeds is the same in each case, the 'engine' is a single file that's referenced by each page that needs it. The referencing page is also where the options are set.
Include the following code wherever you want the blog posts to appear, modifying is as appropriate as explained below. Note that the "Normal" display expects to be its own page, as it outputs the main blog title.
$zpagetitle='Entries tagged with "Video"';
$firstlink='<< Newest entries'
$prevlink='< Newer entries'
$nextlink='Older entries >'
For custom output, with
$blogdisplay set to "custom", Warwick Blogs Grabber will compile the
$blogentries array but will not output it. This allows you to output the entries however you want. The best way to see the structure of the array is to first use the "raw" display option; this will output the array using HTML formatting (i.e. it will display correctly as a normal webpage). After that you can use your favourite method for looping through an array (such as
foreach() in the example above) and then reference each item as you need it.
Most of the data is in its "raw" form; i.e. the link is the URL not an A tag, etc.
- The "tags" are already links; they can just be output without futher work.
- The "time" is just a timecode; it will need formatting with
To download Warwick Blogs Grabber just right-click and choose "Save As" (or the equivalent for your device/web browser).