Report message:*
 

Re: RSSFit module

Subject: Re: RSSFit module
by skenow on 2010/9/29 20:19:45

I also have a copy of RSSFit, if you need one.

If you are running ImpressCMS 1.2, adding an RSS feed is rather simple - did it with SimplyWiki and an old version of News without any major difficulties (just wrestled with htmlspecialchars for some fields).

Create a new file in the root of your module and modify the following code for your module


<?php
/**
* Generating an RSS feed
*
* @copyright http://smartfactory.ca The SmartFactory
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License (GPL)
* @since SimplyWiki 1.2
* @package SimplyWiki
* @version $Id: rss.php 19368 2010-06-08 01:08:18Z skenow $
*/
/** Include the module's header for all pages */
include_once 'header.php';
/** Include the header for the site */
include_once ICMS_ROOT_PATH.'/header.php';

$clean_author = isset($_GET['author']) ? (int) ( $_GET['author'] ) : false;
$clean_type = isset( $_GET['type'] ) ? $_GET['type'] : false;

$module_name = $icmsModule->name();

/** Include the core rss class and create a new feed instance */
include_once ICMS_ROOT_PATH . '/class/icmsfeed.php';
$wiki_feed = new IcmsFeed();

$wiki_feed->title = $module_name . ' - ' . $icmsConfig['sitename'];
$wiki_feed->url = ICMS_URL. '/modules/' . $wikiModDir . '/';
$wiki_feed->description = $icmsConfig['slogan'];
$wiki_feed->language = _LANGCODE;
$wiki_feed->charset = _CHARSET;
$wiki_feed->category = $module_name;

/** Include the SimplyWiki class and create a new instance */
include_once 'class/wiwiRevision.class.php';
$wiki_page_handler = new WiwiRevisionHandler;

/** Establish a handler for determining the page author */
$wiki_author_handler = new XoopsMemberHandler( $xoopsDB );

$pages = $wiki_page_handler->getRevisions( $clean_author, $clean_type );

foreach($pages as $page) {
$wiki_feed->feeds[] = array (
'title' => $page->title,
'link' => str_replace('&', '&', ICMS_URL . '/modules/' . $wikiModDir . '/index.php?page=' . $page->keyword ),
'description' => htmlspecialchars(str_replace('&', '&', ICMS_URL . '/modules/' . $wikiModDir . '/index.php?page=' . $page->keyword ), ENT_QUOTES),
'pubdate' => $page->lastmodified,
'guid' => str_replace('&', '&', ICMS_URL . '/modules/' . $wikiModDir . '/index.php?page=' . $page->keyword ),
'category' => $module_name,
'author' => $wiki_author_handler->getUser( $page->creator )->uname()
);
}

$wiki_feed->render();