domifara, thanks for your reply and sorry for the confusion.
It's actually BopComments backend.php I renamed to rss.php and put on xoops ROOT.
Here's the code. Probably, I did something wrong.
<?php
include_once ("mainfile.php");
$_rss_old_error_level = error_reporting(0);//HACK for no error message ,error_reporting off hack by domifara 2005/4/10
include_once (XOOPS_ROOT_PATH.'/class/template.php');
include_once (XOOPS_ROOT_PATH."/modules/BopComments/include/func.php");
include_once (XOOPS_ROOT_PATH."/modules/BopComments/include/main.php");
if (function_exists('mb_http_output')) {
@mb_http_output('pass');
}
header ('Content-Type:text/xml; charset=UTF-8');
$tpl = new XoopsTpl();
if( @is_object( $xoopsUser ) && $xoopsUser->isAdmin(1) ) {
$tpl->xoops_setCaching(0);
$tpl->xoops_setCacheTime(0);
} else {
$tpl->xoops_setCaching(2);
$tpl->xoops_setCacheTime(3600);
}
//HACK for each lang cache hack by domifara 2005/4/18
if (function_exists('easiestml') && isset($easiestml_lang)){
$rss_cache_lang = $easiestml_lang;
} else {
$rss_cache_lang = $GLOBALS['xoopsConfig']['language'];
}
$xoopsCachedTemplateId = 'rss_'.'|'.md5( __FILE__ . $rss_cache_lang);
if (!$tpl->is_cached('db:BopComments_rss.html' , $xoopsCachedTemplateId)) {
$data = BopComments_main(10);
foreach($data['topic'] as $modid=>$moddata) {
foreach($moddata as $tkey=>$topic) {
$data['topic'][$modid][$tkey]['mod_name'] = $data['name'][$modid];
}
}
$topic = BopComments_arrayMarge($data['topic']);
$topics = BopComments_finalize($topic, 10, 0, 0, 0, 'D, j M Y H:i:s T');
if (is_array($topic)) {
$tpl->assign('channel_title', xoops_utf8_encode(htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)));
$tpl->assign('channel_link', XOOPS_URL.'/');
$tpl->assign('channel_desc', xoops_utf8_encode(htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)));
$tpl->assign('channel_lastbuild', xoops_utf8_encode(formatTimestamp(time(), 'D, j M Y H:i:s T')));
$tpl->assign('channel_language', _LANGCODE);
$tpl->assign('image_url', XOOPS_URL.'/images/logo.gif');
$dimention = getimagesize(XOOPS_ROOT_PATH.'/images/logo.gif');
if (empty($dimention[0])) {
$width = 88;
} else {
$width = ($dimention[0] > 144) ? 144 : $dimention[0];
}
if (empty($dimention[1])) {
$height = 31;
} else {
$height = ($dimention[1] > 400) ? 400 : $dimention[1];
}
$tpl->assign('image_width', $width);
$tpl->assign('image_height', $height);
foreach ($topics as $value) {
$article = "";
if (isset($value['article']) || !empty($value['article'])) {
$article = BopComments_get_Article($value['module'], $value['article']);
}
//HACK for each lang $description 125 byte strings hack by domifara 2005/4/18
//$article = $article->hometext();
if (function_exists('easiestml') && isset($easiestml_lang)) {
$article = easiestml($article);
}
$article = preg_replace("/\[.*?\]/","",$article);//strip tags by Yuji
$article = xoops_substr($article, 0 ,124+4);
//If there's no title, then show "No title" by Yuji
if ($value['topic'] == '') {
$value['topic'] = '['._NOTITLE.']';
}
$tpl->append('items', array('title' => xoops_utf8_encode(htmlspecialchars($value['place']." : ".$value['topic'],ENT_QUOTES)),
'link' => htmlspecialchars($value['topiclink'],ENT_QUOTES),
'guid' => htmlspecialchars($value['topiclink'],ENT_QUOTES),
'pubdate' => xoops_utf8_encode(htmlspecialchars($value['date'],ENT_QUOTES)),
'description' => xoops_utf8_encode(htmlspecialchars($article,ENT_QUOTES))
)
);
}
}
}
$tpl->display('db:BopComments_rss.html' , $xoopsCachedTemplateId);//HACK by domifara
error_reporting($_rss_old_error_level);//error_reporting off hack by domifara 2004/4/8
?>