Get the Code To Run on Your Own Server

This information is for web site owners that would like to incorporate our Feed2JS technology on their own site- perhaps to customize it, or just to speed up the access if they feel like a local copy is better. Below you can download the necessary script files.

We provide this script as open-source under a GNU General Public License.

To run these scripts, you need a web server capable of running PHP which is rather widely available (and free). You will need to FTP files to your server, perhaps change permissions, and make some basic edits to configure it for your system. I give you the code, getting it to work is on your shoulders. I will try to help, but cannot always promise answers.

Installation

  1. Get the Latest Source Code now available on GitHub

    The files provided include:
    1. build.php - a 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.
    2. feed2js_config.php - local configuration, set the file paths for Magpie, etc.
    3. feed2js.php - the main workhorse script; see below for configuration details.
    4. feed2js.inc - another version that you can access from the same server using a PHP include method rather than JavaScript.
    5. footer - text for footer on Feed2JS web pages
    6. magpie - latest version of Magpie RSS.
    7. magpie_debug.php - test script if you have trouble setting up Magpie (best to remove from server if it works OK)
    8. magpie_simple.php - demo page for magpie
    9. nosource.php - a simple error file if the script is not provided an URL for the RSS feed.
    10. popup.js - external Javascript library to enable links to appear in JavaScript generated window.
    11. preview.php - used to generate previews from the build form.
    12. styles - sample style sheets used for the preview feature of the build script.
    13. style_preview.php - generates the styled previews
    14. style.php - a version of our style tool which will allow your web site users to select and modify CSS styles for their feeds.
  2. Download and install the Magpie RSS if you need a newer version than the one provided. Place the magpie files inside the directory that contains for feed2js.php scripts:
    (main server directory)
    
    /feed
      feed2js.php
         :
         :
    
      /magpie
    	/extlib  
    	  Snoopy.class.inc
    	rss_cache.inc
    	rss_fetch.inc
    	rss_parse.inc
    	rss_utils.inc
    	/cache
    	/cache-utf8
    
    The "extlib" directory contains the a library file required by magpie "Snoopy.class.inc".
  3. Inside the magpie directory, are 2 directories named cache and cache_utf8 to store the cache files used by Magpie (the second are for RSS feeds that use UTF8 encoding). Make sure you change the permissions on both of these directories to be world writable (unix commands chmod 0777 cache and chmod 0777 cache_utf8.
  4. Before going further, you may want to run the magpie test file, magpie_debug.php. If you keep this file in the /feed and keep the magpie files in its own subdirectory as provided in the download, there should be no edits required to make this work. Loading this in a web browser, e.g. http://www.mydomain.org/feed/magpie_debug.php will test your magpie installation.

    See if there are PHP errors-- PHP warnings are not a problem and are ignored by the main script.
  5. If Magpie works okay, 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. The default settings will work if you store the magpie files inside the same directory as feed2js.php. This means that you do not have to make any changes to it.
    // MAGPIE SETUP ----------------------------------------------------
    // Define path to Magpie files and load library
    // The easiest setup is to put the 4 Magpie include
    // files in the same directory:
    // define('MAGPIE_DIR', './magpie/')
    
    // Otherwise, provide a full valid file path to the directory
    // where magpie sites
    define('MAGPIE_DIR', './magpie/');
    
    // access magpie libraries
    require_once(MAGPIE_DIR.'rss_fetch.inc');
    require_once(MAGPIE_DIR.'rss_utils.inc');
    
    // value of 2 optionally show lots of debugging info, 0 for production
    define('MAGPIE_DEBUG', 0);
    
    // Define cache age in seconds.
    define('MAGPIE_CACHE_AGE', 60*60);
    
    Some Windows servers do not handle the gmmktime function in line 45- this dynamically determines the server time's offset from GMT. If you see errors on this line, you can edit this line to manually set the time zone offset, e.g.:
     $tz_offset = -7;
    
  6. Run a known RSS Feed through your installed version of the build.php page and then test the style editor page.
  7. If you are unable to see a feed previewed from the build page, there is likely a syntax error in feed2js.php. To isolate the problem, generate the JavaScript string, copy the URL that appears in the src="......" portion, and load it in your web browser. Any PHP errors should appear.

That is all!

The Simplest Installed Directory Structure

Use this outline as a map of the simplest installation, putting all files and Magpie in the same directory. You can create your own intro page (index.php, index.html) and link to the build and style pages accordingly.

/feed (directory)
  build.php      (feed building tool)
  feed2js.php
  feed2js_config.php
  feed2js_inc.php
  footer         (include file for build.php, style.php)
   /magpie (directory)
      /cache  (cache directory)
      /cache_utf8  (cache directory for utf-8 feeds)
      /ext_lib  (directory)        
        Snoopy.class.inc
      rss_cache.inc
      rss_fetch.inc
      rss_parse.inc
      rss_utils.inc
  magpie_debug.php
  magpie_simple.php
  nosource.php   (error page if no RSS provided)
  popup.js (external library for pop up window openers)
  preview.php (generates feed preview)
  /style (directory) (collection of CSS styles)
  style_preview.php (style preview and editor)
  style.php      (output style tool) 

Show us your love, post a badge


Brian Teller
is keeping Feed2JS alive, thanks Brian (applause)

Digital Signage Report

github
github project site



Feed2JS is fueled by Magpie RSS