NEWSモジュールのカスタマイズ2(複数NEWSモジュールでのRSS配信)

※以下、自己責任でお願いします。

複数のNEWSモジュールをインストールできる、「news複製9個セット」は便利ですが、あれのRSS配信を普通にbackend.phpから取得すると、通常のNEWSモジュールの分のRSSになります。
そこで、XOOPSのルートディレクトリにあるbackend.phpを書き換えます。
※以下は複製したNEWSモジュール名がnews1の場合です。
30行目

include_once XOOPS_ROOT_PATH.'/modules/news/class/class.newsstory.php';

include_once XOOPS_ROOT_PATH.'/modules/news1/class/class.newsstory.php';

にする。

47行目

$tpl->assign('channel_category', 'News');

$tpl->assign('channel_category', 'News1');

にする。

66行目

$tpl->append('items', array('title' => xoops_utf8_encode(htmlspecialchars($story->title(), ENT_QUOTES)), 'link' => XOOPS_URL.'/modules/news/article.php?storyid='.$story->storyid(), 'guid' => XOOPS_URL.'/modules/news/article.php?storyid='.$story->storyid(), 'pubdate' => formatTimestamp($story->published(), 'rss'), 'description' => xoops_utf8_encode(htmlspecialchars($story->hometext(), ENT_QUOTES))));

$tpl->append('items', array('title' => xoops_utf8_encode(htmlspecialchars($story->title(), ENT_QUOTES)), 'link' => XOOPS_URL.'/modules/news1/article.php?storyid='.$story->storyid(), 'guid' => XOOPS_URL.'/modules/news1/article.php?storyid='.$story->storyid(), 'pubdate' => formatTimestamp($story->published(), 'rss'), 'description' => xoops_utf8_encode(htmlspecialchars($story->hometext(), ENT_QUOTES))));

にする。

ちなみに、39行目の

$sarray = NewsStory::getAllPublished(10, 0);

$sarray = NewsStory::getAllPublished(5, 0);

などにすると、RSSに掲載する記事件数を10件から5件に減らせます。


以上の操作が終わったらファイルをアップロードして、FTPソフトでXOOPSのルートからcacheディレクトリの「ほにゃららsystem_rss.html」を削除します。
これで、複製したNEWSモジュールでのRSSが取得できます。