Reply New Topic
2010/9/29 20:19:45
#1
Offline
Home away from home

Re: RSSFit module

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();

_________________

Steve Twitter: @skenow Facebook: Steve Kenow


Subject Poster Date
     RSSFit module fiammybe 2010/9/29 5:29:04
       Re: RSSFit module fiammybe 2010/9/29 5:33:18
         Re: RSSFit module McDonald 2010/9/29 6:05:16
           Re: RSSFit module skenow 2010/9/29 20:19:45
             Re: RSSFit module fiammybe 2010/9/30 0:24:39
Reply New Topic extras
 Previous Topic   Next Topic
You can view topic.
You can start a new topic.
You can reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You can post without approval.