/* ====================================================================== Get, cache, and output contents of a RSS XML file Author: George at JavaScriptKit.com/ DynamicDrive.com Created: Feb 1st, 2006. Updated: Feb 1st, 2006 ====================================================================== */ header('Content-type: text/xml'); // ------------------------------------------------------------------- // Enter list of possible RSS feeds to fetch inside array: // ------------------------------------------------------------------- $rsslist=array( "CNN" = "http://rss.cnn.com/rss/cnn_topstories.rss",; "BBC" = "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml",; "news.com" = "http://news.com.com/2547-1_3-0-5.xml",; "slashdot" = "http://rss.slashdot.org/Slashdot/slashdot",; "dynamicdrive" = "http://www.dynamicdrive.com/export.php?type=new" ); $cachefolder="cache"; //path to cache directory. No trailing "/". Set dir permission to read/write! // ------------------------------------------------------------------- // Determine which RSS file to actually fetch // Based on the value of the "id" parameter of the URL string mapping to the RSS array's key // ------------------------------------------------------------------- $rssid=$_GET['id']; $rssurl=isset($rsslist[$rssid])? $rsslist[$rssid] : die("Error: Can't find requested RSS in list."); $localfile=$cachefolder. "/" . urlencode($rssurl); //Name cache file based on RSS URL // ------------------------------------------------------------------- // Get the minutes to cache the local RSS file based on "cachetime" parameter of URL string // ------------------------------------------------------------------- $cacheminutes=(int) $_GET["cachetime"]; //typecast "cachetime" parameter as integer (0 or greater) // ------------------------------------------------------------------- // fetchfeed() gets the contents of an external RSS feed, // and saves its contents to the "cached" file on the server // ------------------------------------------------------------------- function fetchfeed(){ global $rssurl, $localfile; $contents=file_get_contents($rssurl); //fetch RSS feed $fp=fopen($localfile, "w"); fwrite($fp, $contents); //write contents of feed to cache file fclose($fp); } // ------------------------------------------------------------------- // outputrsscontent() outputs the contents of a RSS feed using the cached local RSS file // It checks if a cached version of the RSS feed is available, and if not, creates one first. // ------------------------------------------------------------------- function outputrsscontent(){ global $rssurl, $localfile, $cacheminutes; if (!file_exists($localfile)){ //if cache file doesn't exist touch($localfile); //create it chmod($localfile, 0666); fetchfeed(); //then populate cache file with contents of RSS feed } else if (((time()-filemtime($localfile))/60)($cacheminutes) //if age of cache file great than cache minutes setting fetchfeed(); readfile($localfile); //return the contents of the cache file } outputrsscontent(); /?>
[goal(right)]--> Just to keep this simple to viewers; that, to much javascript can make things to complicated, whether menu scripts, navigation tools, or fancy pictures and background images.
Okay, visitors to this site that have read this far...
Welcome Aboard the Ole_Ship TOPICS[top deck] [menu] [map] [description/about] [thought to reality/...there is room here][above]
Click here to see a sample
"javascript:ajaxshowme(Eclipse My Ajax,;)
This free script provided by http://javascriptkit.com/dhtmltutors/ajaxticker/ajaxticker4.shtml
...here are some elements of this "Ole_Ship"
JavaScript Kit
Ole_Ship RSS
search/RAfeed.xml
<rss>-<channel><title>Ole_ship RSS Aggregator</title>
<link>+search/RAfeed.html</link></channel></rss>
1431 - Gavin Menzies (author)
Gavin Menzies (author)
Parts Of A Ship (Sanctuary-NOAA)