Feed2JS: RSS to JavaScript PHP scripts September 10, 2004 ----------------------------------------------------------------- Copyright (C) 2004 Alan Levine (Maricopa Community Colleges). It is available as both a free service and open source code from: http://jade.mcli.dist.maricopa.edu/feed/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details http://www.gnu.org/licenses/gpl.html ----------------------------------------------------------------- Installation ============ 1. The files here include: a. feed2js.php - the main workhorse script; see below for configuration details. b. feed2js_config.php - local configuration settings are accesed via an include c. nosource.php - a simple error file if the script is not provided an URL for the RSS feed. d. build.php - a basic version of our build page which will allow your web site users to easily generate their proper JavaScript that works from your installation of Feed2JS. e. style.php - a tool to help users select / modify CSS for feed display f. feed2php.inc - a modified version of the script that works the same, except the output is generated from PHP rather than JavaScript 2. You should next download and install the Magpie RSS library: http://magpierss.sourceforge.net/ Take some time to consider how you will be using Feed2JS- for most uses you can put the Magpie and Feed2JS files in the same directory, but there is no reason why you could not place Magpie in a centralized include area. Just keep track of the file paths where things are stored. Magpie has 4 include files: a. rss_cache.inc b. rss_fetch.inc c. rss_parse.inc d. rss_utils.inc and an "extlib" directory containing "Snoopy.class.inc". Feed2JS will require all of these (but does not use the "smarty" files provided with Magpie). 3. Edit rss_fetch.inc to define the file paths in the first section, including default values for DIR_SEP and MAGPIE_DIR. That should be all the configuration you will need for Magpie. This is not strictly needed as all of the values are declared in the feed2js_config.php file. 4. Create a new directory to store the cache files created and used by Magpie. The easiest location is within the same place you put the Magpie files, but it can be anywhere on your server, as long as you know the file path. Make sure you change the permissions on this directory to 0777. About 90% of the set up problems are due to not creating this directory or having its permission set to be writable. 5. Test your installation of Magpie by uploading the scripts provided by Magpie, magpie_debug.php and/or magpie_simple.php. These are some simple PHP files, but you will have to define your local values for file paths, etc. 6. If Magpie works good, you are ready to configure the feed2js_config.php file. Look for the section labeled "INCLUDES" where you must define the correct paths for the Magpie files, the cache directory, and the time setting for having cache files expire, in seconds. the default is 60*60 or one hour. 7. Run a known RSS Feed through your installed version of the build.php page. That is all! Using the PHP include variation: ================================ The approach is the same but declare the needed variables prior to the include statement for any page using the code: Since this version now puts common code in the feed2js_config.php file, you can use more than one instance of this per page. The Simplest Installed Directory Structure ========================================== Use this outline as a map of the simplest installation, putting all files and Magpie in the same directory: /feed (directory) /chache (directory) /ext_lib (directory) Snoopy.class.inc feed2js.php feed2js_config.php feed2php.inc build.php nosource.php style.php style_preview.php /styles (directory) rss_cache.inc rss_fetch.inc rss_parse.inc rss_utils.inc