summaryrefslogtreecommitdiffstats
path: root/website/new/rss-aggregator.php
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-06-08 14:06:41 -0400
committerMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-06-08 14:06:41 -0400
commit066b6fd14f91959ff7272d1303ccab273d61ff6a (patch)
treebffb260b2ae6e8c03d5679bf0b654fdc8fc2b3f2 /website/new/rss-aggregator.php
parent874512b0792ad4d33020642e710e9f9df1c446ca (diff)
downloadthird_party-cobbler-066b6fd14f91959ff7272d1303ccab273d61ff6a.tar.gz
third_party-cobbler-066b6fd14f91959ff7272d1303ccab273d61ff6a.tar.xz
third_party-cobbler-066b6fd14f91959ff7272d1303ccab273d61ff6a.zip
Put cobbler website under version control, some changes still TBA
Diffstat (limited to 'website/new/rss-aggregator.php')
-rwxr-xr-xwebsite/new/rss-aggregator.php73
1 files changed, 73 insertions, 0 deletions
diff --git a/website/new/rss-aggregator.php b/website/new/rss-aggregator.php
new file mode 100755
index 0000000..9cbb837
--- /dev/null
+++ b/website/new/rss-aggregator.php
@@ -0,0 +1,73 @@
+<h1>Simple RSS agregator</h1>
+<a href="http://www.webdot.cz/lastrss/">
+<img src="lastrss_button.gif" alt="" width="88" height="31" border="0">
+</a><hr>
+<!-- / Heading -->
+
+<?php
+/*
+ ======================================================================
+ lastRSS usage DEMO 3 - Simple RSS agregator
+ ----------------------------------------------------------------------
+ This example shows, how to create simple RSS agregator
+ - create lastRSS object
+ - set transparent cache
+ - show a few RSS files at once
+ ======================================================================
+*/
+
+function ShowOneRSS($url) {
+ global $rss;
+ if ($rs = $rss->get($url)) {
+ echo "<big><b><a href=\"$rs[link]\">$rs[title]</a></b></big><br />\n";
+ echo "$rs[description]<br />\n";
+
+ echo "<ul>\n";
+ foreach ($rs['items'] as $item) {
+ echo "\t<li><a href=\"$item[link]\" title=\"$item[description]\">$item[title]</a></li>\n";
+ }
+ if ($rs['items_count'] <= 0) { echo "<li>Sorry, no items found in the RSS file :-(</li>"; }
+ echo "</ul>\n";
+ }
+ else {
+ echo "Sorry: It's not possible to reach RSS file $url\n<br />";
+ // you will probably hide this message in a live version
+ }
+}
+
+// ===============================================================================
+
+// include lastRSS
+include "./rss-parser.php";
+
+// List of RSS URLs
+$rss_left = array(
+ 'http://freshmeat.net/backend/fm.rdf',
+ 'http://slashdot.org/slashdot.rdf'
+);
+$rss_right = array(
+ 'http://www.freshfolder.com/rss.php',
+ 'http://phpbuilder.com/rss_feed.php'
+);
+
+// Create lastRSS object
+$rss = new lastRSS;
+
+// Set cache dir and cache time limit (5 seconds)
+// (don't forget to chmod cahce dir to 777 to allow writing)
+$rss->cache_dir = './temp';
+$rss->cache_time = 1200;
+
+
+// Show all rss files
+echo "<table cellpadding=\"10\" border=\"0\"><tr><td width=\"50%\" valign=\"top\">";
+foreach ($rss_left as $url) {
+ ShowOneRSS($url);
+}
+echo "</td><td width=\"50%\" valign=\"top\">";
+foreach ($rss_right as $url) {
+ ShowOneRSS($url);
+}
+echo "</td></tr></table>";
+?>
+