Home

Download

Video

Guide

Editor

E-mail

News

Streaming

Link

Guestbook



 

Inserire Feed RSS in una pagina web

 

Questa guida è per i webmaster ke vogliono inserire la tecnologia Feed2JS nel loro sito.

Per far partire questo scripts, serve un web server compatibile con PHP e devi poter accedere a un FTP server.

Installazione

  1. Prendi l'ultima versione del codice disponibile su eduforge

    Il Codice comprende:
    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 - a modified version of version 0.71 of Magpie RSS (modifications allow parsing of RSS enclosures).
    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. Scarica e installa Magpie RSS (facoltativo) se ti occorre una nuova versione rispetto a quella trovata nello script iniziale. Metti i file di Magpie all'interno della cartella che contiene lo script feed2js.php:
    (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
  3. All'interno della cartella Magpie, ci sono due cartelle chiamate cache and cache_utf8 per conserver i file di cache usati da Magpie (la seconda è per gli  RSS feeds che usano l'UTF8 encoding). Cambiate i permessi in entrambe le cartelle affinchè sia permessa la scrittura e l'esecuzione (comandi unix chmod 0777 cache e chmod 0777 cache_utf8.
  4. Dopo eseguite il file test di magpie, magpie_debug.php. Caricate questo file su browser, e.s. http://www.mydomain.org/feed/magpie_debug.php per  testare la vostra installazione di Magpie.

    Se ci sono errori PHP essi non sono un problema e saranno ignorati dallo script principale.
  5. Se dopo il test Magpie è OK, allora siete pronti per configurare il file feed2js_config.php. Cercate la sezione chiamata "INCLUDES" dove dovete inserire il percorso corretto per i file di Magpie. Potete lasciare i settaggi di default se i file di magpie si trovano nella stessa cartella di feed2js.php. Questo significa che non dovete cambiare nulla.
    // 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);
    Alcuni server windows non riconoscono la funzione gmmktime sul rigo 45(che determina l'ora rispetto all'orario UTC).Se vedi errori su questa riga,puoi modificare la riga manualmente settando il tuo fusorario , e.s. (Italia):
     $tz_offset = +1;
  6. Apri dal browser la pagina build.php per configurare lo script e ottenere il codice javascript da inserire nella pagina in cui vuoi che compaiano i feed e successivamente potrai accedere alla pagina degli stili.
  7. Se non puoi vedere una anteprima dei feed dalla pagina build.php, ci sarà sicuramente qualche errore di sintassi in feed2js.php. Per isolare il problema, genera una stringa javascript, copia l'URL che ti appare nella parte src="......" ,e caricalo nel tuo browser. Tutti gli errori Php appariranno.

Questo è tutto!

Struttura delle cartelle di installazione

Usa questa come una mappa per semplificarti l'installazione,metti tutti i file e Magpie nella stessa cartella.

/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)