News feeds in a static pageNews feeds in a static pageThis is a simple way to include news feeds in a static page, if you don't want to mess around with My Headlines and other plugins, but just want to add one (or more) cached feeds to a page. All you need is one file in your geeklog system directory, or wherever you like, and five lines of code.
global $_CONF;
include( $_CONF['path_system'] . "/lib-rss.php" ); $file = "test.rdf"; $feed = "http://news.bbc.co.uk/rss/newsonline_world_edition/science/nature/rss091.xml"; $time = time() - 3600; print staticpageRSS ( $file, $feed, $time ); How to do it
CaveatsThe first time you open a feed, you will get an error as the file does not exist yet. Just refresh the page. If that doesn't work, you may need to create the file yourself. ModificationsIf you open the file lib-rss.php, you will see that the first function is what calls the other code and determines where the cache is saved, and the format of the returned page. You can easily edit this to suit your tastes. This has not been heavily tested, so please let me know if you have any problems. Creditslib-rss.php contains another file that does all the real work.
|
|
Copyright © 2010 Heather Engineering All trademarks and copyrights on this page are owned by their respective owners. |
Powered By Geeklog Built by Heather Engineering |