1
novlang1984
Rss plugin for xNews ?

I would like to grab my news with RSSFIT module, but I can not find appropriate plugin.

There is a plugin for News but I use xNews 1.71 and it is too late for me to go back, I've designed all my templates and already entered some articles :(

News plugin is rssfit.news.php :
<?php
if( !defined('RSSFIT_ROOT_PATH') ){ exit(); }
class 
RssfitNews{
    var 
$dirname 'news';
    var 
$modname;
    var 
$grab;
    
    function 
RssfitNews(){
    }
    
    function 
loadModule(){
        
$mod =& $GLOBALS['module_handler']->getByDirname($this->dirname);
        if( !
$mod || !$mod->getVar('isactive') ){
            return 
false;
        }
        
$this->modname $mod->getVar('name');
        
$this->module =& $mod;
        return 
$mod;
    }
    
    function &
grabEntries(&$obj){
        
$ret false;
        @include_once 
XOOPS_ROOT_PATH.'/modules/news/class/class.newsstory.php';
        
$myts =& MyTextSanitizer::getInstance();
        if( 
$this->module->getVar('version') >= 130 ){
            @include_once 
XOOPS_ROOT_PATH.'/modules/news/include/functions.php';
            
$news NewsStory::getAllPublished($this->grab0news_getmoduleoption('restrictindex'));
        }else{
            
$news NewsStory::getAllPublished($this->grab0);
        }
        if( 
count($news) > ){
            for( 
$i=0$i<count($news); $i++ ){
                
$ret[$i]['title'] = $myts->undoHtmlSpecialChars($news[$i]->title());
                
$ret[$i]['link'] = XOOPS_URL.'/modules/news/article.php?storyid='.$news[$i]->storyid();
                
$ret[$i]['guid'] = XOOPS_URL.'/modules/news/article.php?storyid='.$news[$i]->storyid();
                
$ret[$i]['timestamp'] = $news[$i]->published();
                
$desc $news[$i]->hometext();
                
$ret[$i]['description'] = $news[$i]->hometext();
                
$ret[$i]['category'] = $this->modname;
                
$ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/';
            }
        }
        return 
$ret;
    }
}
?>


I'm trying various combinations but in vain, my skills are not enough, blank pages :'(

Does anyone know what to change in this code?

Thanks.

2
novlang1984
Re: Rss plugin for xNews ?

I think I've found :)

In my case, xNews is cloned, I hope there is no mistake below

1. Rename your file by replacing rssfit.news.php with rssfit.yourmodulefoldername.php

2. Replace
RssfitNews
... by
RssfitYourmodulefoldername

3. Replace
var $dirname = 'news';
...by
var $dirname = 'yourmodulefoldername';

4. Replace :
@include_once XOOPS_ROOT_PATH.'/modules/news/class/class.newsstory.php';

... by
@include_once XOOPS_ROOT_PATH.'/modules/yourmodulefoldername/class/class.newsstory.php';


... and
@include_once XOOPS_ROOT_PATH.'/modules/news/include/functions.php';

... by
@include_once XOOPS_ROOT_PATH.'/modules/yourmodulefoldername/include/functions.php';


5. Replace :
Quote:
$news = NewsStory::getAllPublished($this->grab, 0, news_getmoduleoption('restrictindex'));

... by
Quote:
$news = nw_NewsStory::getAllPublished($this->grab, 0, nw_getmoduleoption('restrictindex'));


6. Replace :
Quote:
$news = NewsStory::getAllPublished($this->grab, 0);

... by
Quote:
$news = nw_NewsStory::getAllPublished($this->grab, 0);


7. Replace
$ret[$i]['link'] = XOOPS_URL.'/modules/news/article.php?storyid='.$news[$i]->storyid();
$ret[$i]['guid'] = XOOPS_URL.'/modules/news/article.php?storyid='.$news[$i]->storyid();

... by
$ret[$i]['link'] = XOOPS_URL.'/modules/yourmodulefoldername/article.php?storyid='.$news[$i]->storyid();
$ret[$i]['guid'] = XOOPS_URL.'/modules/yourmodulefoldername/article.php?storyid='.$news[$i]->storyid();


8. Declare this new plugin in the RSSFit administration



Important : if you use a cloned version replace
- nw_NewsStory by nw2_NewsStory, nw3_NewsStory, etc.
- nw_getmoduleoption by nw2_getmoduleoption, nw3_getmoduleoption, etc.

3
novlang1984
Plugins for xNews ?

To resume

1. RSSFit plugin should be RssfitXnews.php (to test !)
<?php
if( !defined('RSSFIT_ROOT_PATH') ){ exit(); }
class 
RssfitXnews{
    var 
$dirname 'xnews';
    var 
$modname;
    var 
$grab;
    
    function 
RssfitXnews(){
    }
    
    function 
loadModule(){
        
$mod =& $GLOBALS['module_handler']->getByDirname($this->dirname);
        if( !
$mod || !$mod->getVar('isactive') ){
            return 
false;
        }
        
$this->modname $mod->getVar('name');
        
$this->module =& $mod;
        return 
$mod;
    }
    
    
    function &
grabEntries(&$obj){
        
$ret false;
        @include_once 
XOOPS_ROOT_PATH.'/modules/xnews/class/class.newsstory.php';
        
$myts =& MyTextSanitizer::getInstance();
        if( 
$this->module->getVar('version') >= 130 ){
            @include_once 
XOOPS_ROOT_PATH.'/modules/xnews/include/functions.php';
            
$news nw_NewsStory::getAllPublished($this->grab0nw_getmoduleoption('restrictindex'));
        }else{
            
$news nw_NewsStory::getAllPublished($this->grab0);
        }
        if( 
count($news) > ){
            for( 
$i=0$i<count($news); $i++ ){
                
$ret[$i]['title'] = $myts->undoHtmlSpecialChars($news[$i]->title());
                
$ret[$i]['link'] = XOOPS_URL.'/modules/xnews/article.php?storyid='.$news[$i]->storyid();
                
$ret[$i]['guid'] = XOOPS_URL.'/modules/xnews/article.php?storyid='.$news[$i]->storyid();
                
$ret[$i]['timestamp'] = $news[$i]->published();
                
$desc $news[$i]->hometext();
                
$ret[$i]['description'] = $news[$i]->hometext();
                
$ret[$i]['category'] = $this->modname;
                
$ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/';
            }
        }
        return 
$ret;
    }
    
    
}
?>



2. Sitemap plugin is xnews.php
<?php
function b_sitemap_xnews(){
    
$xoopsDB =& Database::getInstance();

    
// xnews
    
$block sitemap_get_categoires_map($xoopsDB->prefix("[b][color=006600]nw_topics[/color][/b]"), "topic_id""topic_pid""topic_title""index.php?storytopic=""topic_title");

    return 
$block;
}
?>



3. Waiting plugin
<?php
function b_waiting_xnews(){
    
$xoopsDB =& Database::getInstance();
    
$block = array();

    
// news
    
$result $xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("[b][color=006600]nw_stories[/color][/b]")." WHERE published=0");
    if ( 
$result ) {
        
$block['adminlink'] = XOOPS_URL."/modules/xnews/admin/index.php?op=newarticle" ;
        list(
$block['pendingnum']) = $xoopsDB->fetchRow($result);
        
$block['lang_linkname'] = _PI_WAITING_SUBMITTED ;
    }

    return 
$block;
}
?>


4
timgno
Re: Rss plugin for xNews ?
  • 2011/2/18 10:14

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21


this does not work with xoops 2.5.0, read the Intro post edit:

Quote:
Version of XOOPS does not meet the system requirement. RSSFit may not work properly

actually seeing the blank page

look:http://www.txmodxoops.org/modules/rss/

5
novlang1984
Re: Rss plugin for xNews ?

I use RSS 1.22 with Xoops 2.5, and you ?

6
timgno
Re: Rss plugin for xNews ?
  • 2011/2/18 21:36

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21


In use is 1.02, and now,

I have updated to your 1.22, but this not working properly.

This module is obsolete anyway, especially in administration, I can not load the plugin, when I click on the link plugin, it seems the line of the menu, but with blank page.

Do you have a link where we can check the functionality?

thanks

Login

Who's Online

222 user(s) are online (156 user(s) are browsing Support Forums)


Members: 0


Guests: 222


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