1
soconfused
Custom xppb plugin for rss fit module
  • 2005/7/14 19:32

  • soconfused

  • Not too shy to talk

  • Posts: 108

  • Since: 2005/4/2 1


Hello,

I'm trying to create a custom plugin for the rss fit module, but I'm stuck - I want to output latest topics to an rss feed, I've got it so far but the rss doesn't display any topics, here's the code - can anyone see whats wrong.
Quote:
<?php
// $Id: rssfit.pluginsample.php,v 1.1 2005/03/07 09:20:05 tuff Exp $
###############################################################################
## RSSFit - Extendable XML news feed generator ##
## Copyright (c) 2004 - 2005 NS Tai (aka tuff) ##
## <http://www.brandycoke.com/> ##
###############################################################################
## XOOPS - PHP Content Management System ##
## Copyright (c) 2000 XOOPS.org ##
## <https://xoops.org/> ##
###############################################################################
## 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. ##
## ##
## You may not change or alter any portion of this comment or credits ##
## of supporting developers from this source code or any supporting ##
## source code which is considered copyrighted (c) material of the ##
## original comment or credit authors. ##
## ##
## 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. ##
## ##
## You should have received a copy of the GNU General Public License ##
## along with this program; if not, write to the Free Software ##
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ##
###############################################################################
/*
* This file is a dummy for making a RSSFit plug-in, follow the following steps
* if you really want to do so.
* Step 0: Stop here if you are not sure what you are doing, it's no fun at all
* Step 1: Clone this file and rename as something like rssfit.[mod_dir].php
* Step 2: Replace the text "RssfitSample" with "Rssfit[mod_dir]" at line 58 and
* line 64, i.e. "RssfitNews" for the module "News"
* Step 3: Modify the word in line 59 from 'sample' to [mod_dir]
* Step 4: Modify the function "grabEntries" to satisfy your needs
* Step 5: Move your new plug-in file to the RSSFit plugins folder,
* i.e. your-xoops-root/modules/rss/plugins
* Step 6: Install your plug-in by pointing your browser to
* your-xoops-url/modules/rss/admin/?do=plugins
* Step 7: Finally, tell us about yourself and this file by modifying the
* "About this RSSFit plug-in" section which is located... somewhere.
*
* [mod_dir]: Name of the driectory of your module, i.e. 'news'
*
* About this RSSFit plug-in
* Author: John Doe <http://www.your.site/>
* Requirements:
* Module: Blah <http://www.where.to.find.it/>
* Version: 1.0
* RSSFit verision: 1.1
*/

if( !defined('RSSFIT_ROOT_PATH') ){ exit(); }
class rssfitpbboard{
var $dirname = 'pbboard';
var $modname;
var $grab;
var $module; // optional, see line 74

function RssfitPbboard(){
}

function loadModule(){
global $module_handler;
$mod = $module_handler->getByDirname($this->dirname);
if( !$mod || !$mod->getVar('isactive') ){
return false;
}
$this->modname = $mod->getVar('name');
$this->module =& $mod; // optional, remove this line if there is nothing
// to do with module info when grabbing entries
return $mod;
}

function grabEntries(&$obj){
global $xoopsDB;
$ret = array();
$i = 0;
// The following example code grabs the latest entries from the module MyLinks
$sql = "SELECT l.lid, l.cid, l.title, l.date, t.description FROM ".$xoopsDB->prefix("xoops_pbb")." l, ".$xoopsDB->prefix("xoops_pbb_topics")." t WHERE l.status > 0 AND l.lid = t.lid ORDER BY date DESC";
$result = $xoopsDB->query($sql, $this->grab, 0);
while( $row = $xoopsDB->fetchArray($result) ){
$link = XOOPS_URL.'/modules/'.$this->dirname.'topic.forum_id'.$row['cid'].'&lid='.$row['lid'];
/*
* Required elements of an RSS item
*/
// 1. Title of an item
$ret[$i]['title'] = $row['title'];
// 2. URL of an item
$ret[$i]['link'] = $link;
// 3. Item modification date, must be in Unix time format
$ret[$i]['timestamp'] = $row['date'];
// 4. The item synopsis, or description, whatever
$ret[$i]['description'] = $row['description'];
/*
* Optional elements of an RSS item
*/
// 5. The item synopsis, or description, whatever
$ret[$i]['guid'] = $link;
// 6. A string + domain that identifies a categorization taxonomy
$ret[$i]['category'] = $this->modname;
$ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/';
$i++;
}
return count($ret) > 0 ? $ret : false;
}
}
?>

Login

Who's Online

250 user(s) are online (170 user(s) are browsing Support Forums)


Members: 0


Guests: 250


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits