1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | <?php // Agency X updated Y, new files, diff of plain text/link text, // feed for just one agency or all // This is a minimum example of using the Universal Feed Generator Class include("lib/FeedWriter.php"); //Creating an instance of FeedWriter class. $TestFeed = new FeedWriter(RSS2); //Setting the channel elements //Use wrapper functions for common channelelements $TestFeed->setTitle('Last Modified - All'); $TestFeed->setLink('http://disclosr.lambdacomplex.org/rss.xml.php'); $TestFeed->setDescription('This is test of creating a RSS 2.0 feed Universal Feed Writer'); //Retriving informations from database $rows = $db->get_view("app", "byLastModified")->rows; //print_r($rows); foreach ($rows as $row) { //Create an empty FeedItem $newItem = $TestFeed->createNewItem(); //Add elements to the feed item $newItem->setTitle($row['name']); $newItem->setLink($row['id']); $newItem->setDate(date("c", $row['metadata']['lastModified'])); $newItem->setDescription($row['name']); //Now add the feed item $TestFeed->addItem($newItem); } //OK. Everything is done. Now genarate the feed. $TestFeed->genarateFeed(); ?> |