Camen Design Forum


(Leave this as-is, it’s a trap!)

To delete this post you must be either the original author or a designated moderator.
The content of the post will be removed but the name and date will remain.

  • The post will be removed completely from the thread, rather than blanked
  • Only posts on the last page of the thread can be removed completely (so as to not break permalinks)

RE[4]: How to get latest posts


With the help from Stackoverflow and Google :)
Quick and dirty small script that grabs the entrys and sorts them per date. The interesting part is between //====.
Defining feeds this way suits me well. You prabably need to do something recursive. The last part i just use to test and display.
This works fine for me right now but probably not for others.

//Define feeds
foreach (glob("*/index.xml") as $filename) {
$feeds[] = $filename;
// Get all feed entries
$entries = array();
foreach ($feeds as $feed) {
$xml = simplexml_load_file($feed);
$entries = array_merge($entries, $xml->xpath('/rss//item'));

// Sort feed entries by pubDate (descending)
usort($entries, function ($x, $y) {
return strtotime($y->pubDate) - strtotime($x->pubDate);

foreach ($entries as $entry){

echo "$entry->author." : ".$entry->title."<p>".$entry->pubDate."</p><p>".strip_tags(mb_substr($entry->description, 0, 100, 'UTF-8')) . '...';

Your friendly neighbourhood moderators: Kroc, Impressed, Martijn