1
bjuti
Classifieds RSSFit plugin
  • 2010/1/18 15:27

  • bjuti

  • Just can't stay away

  • Posts: 871

  • Since: 2009/1/7 2


I've googled and searched forums, and I didn't find RSSFit plugin for Classifieds module. So I used plugin for Jobs module (www.jlmzone.com) as a base.

So here it is (copy/paste following code in editor and save it as "rssfit.classifieds.php" then copy file in modules/rss/plugins/).

<?php
// $Id: rssfit.pluginsample.php 70 2005-11-09 16:06:22Z tuff $
###############################################################################
##                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 ##
###############################################################################
/*
* Classifieds RSSFit plugin based on Jobs RSSFit plugin by www.jlmzone.com
* Done by Bjuti (www.bjuti.info)

* About this RSSFit plug-in
* Author: Bjuti (www.bjuti.info) based in Jobs plugin by John Mordo <http://www.jlmzone.com/>
* Requirements (or Tested with):
*  Module: Classifeds <http://www.jlmzone.com/modules/mydownloads/>
*  Version: 2.0RC
*  Last release date:  Jan. 18 2010
*  RSSFit verision: 1.2 / 1.5
*  XOOPS version: 2.0.13.2 / 2.2.3 / 2.3.2b / 2.4.3
*/

if( !defined('RSSFIT_ROOT_PATH') ){ exit(); }
class 
RssfitClassifieds{
    var 
$dirname 'classifieds';
    var 
$modname;
    var 
$grab;
    var 
$module;    // optional, see line 74
    
    
function RssfitClassifieds(){
    }
    
    function 
loadModule(){
        
$mod =& $GLOBALS['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;
        
$myts =& MyTextSanitizer::getInstance();
        
$ret false;
        
$i 0;
    
//    The following example code grabs the latest entries from the module MyLinks
        
$sql "SELECT lid, title, status, desctext, date from ".$xoopsDB->prefix("classifieds_listing")." WHERE valid = 'Yes' ORDER BY date DESC";
        
$result $xoopsDB->query($sql$this->grab0);
        while( 
$row $xoopsDB->fetchArray($result) ){
            
$link XOOPS_URL.'/modules/'.$this->dirname.'/index.php?pa=viewads&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['desctext'];  // $myts->displayTarea($row['desctext']);
        /*
        * 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.'/';
        //    7. extra tags examples
            
$ret[$i]['extras'] = array();
            
$i++;
        }
        return 
$ret;
    }
}
?>


Works for me, let me know does it works for you. Any help is more than welcome :)

P.S. Check out:
Classifieds + Fancybox

and

Classifieds + Meta Description

Login

Who's Online

176 user(s) are online (92 user(s) are browsing Support Forums)


Members: 0


Guests: 176


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