It's not hard to do, but you will need to change the PHP file news_top.php, found in modules/news/blocks/.
Best to first make a copy of news_top.php, in case something goes wrong
Then you need to replace the sql statements in the function b_news_top_show with the following code :
if ( $options[3] == 0 ) {
$sql = "SELECT storyid, title, published, expired, counter, topic_title FROM
".$xoopsDB->prefix("stories")." , ".$xoopsDB->prefix("topics")." t WHERE published < ".time()."
AND published > 0 AND (expired = 0 OR expired > ".time().") AND topicid = t.topic_id ORDER BY
".$options[0]." DESC";
}
else {
$sql = "SELECT storyid, title, published, expired, counter, topic_title FROM
".$xoopsDB->prefix("stories")." , ".$xoopsDB->prefix("topics")." t WHERE published < ".time()."
AND published > 0 AND (expired = 0 OR expired > ".time().") AND topicid in
".$topicpick." AND topicid = t.topic_id ORDER BY ".$options[0]." DESC";
} $result = $xoopsDB->query($sql,$options[1],0);
Next, find $news = array(); in the same function.
After that replace the $title = with the following code :
$topic_title = $myts->makeTboxData4Show($myrow["topic_title"]);
$title = $topic_title . " :: " . $myts->makeTboxData4Show($myrow["title"]);
The complete function should look like this :
function b_news_top_show($options) {
global $xoopsDB;
$myts =& MyTextSanitizer::getInstance();
$block = array();
$options_new = array_slice ( $options, 3 );
$topicpick = '('.implode ( ',', $options_new ).')';
if ( $options[3] == 0 ) {
$sql = "SELECT storyid, title, published, expired, counter, topic_title FROM
".$xoopsDB->prefix("stories")." , ".$xoopsDB->prefix("topics")." t WHERE published < ".time()."
AND published > 0 AND (expired = 0 OR expired > ".time().") AND topicid = t.topic_id ORDER BY
".$options[0]." DESC";
}
else {
$sql = "SELECT storyid, title, published, expired, counter, topic_title FROM
".$xoopsDB->prefix("stories")." , ".$xoopsDB->prefix("topics")." t WHERE published < ".time()."
AND published > 0 AND (expired = 0 OR expired > ".time().") AND topicid in
".$topicpick." AND topicid = t.topic_id ORDER BY ".$options[0]." DESC";
} $result = $xoopsDB->query($sql,$options[1],0);
while ( $myrow = $xoopsDB->fetchArray($result) ) {
$news = array();
$topic_title = $myts->makeTboxData4Show($myrow["topic_title"]);
$title = $topic_title . " :: " . $myts->makeTboxData4Show($myrow["title"]);
if (strlen($title) > $options[2]) {
$title = xoops_substr($title,0,$options[2]+3);
}
$news['title'] = $title;
$news['id'] = $myrow['storyid'];
if ( $options[0] == "published" ) {
$news['hits'] = formatTimestamp($myrow['published'],"s");
$news['date'] = formatTimestamp($myrow['published'],"s");
} elseif ( $options[0] == "counter" ) {
$news['hits'] = $myrow['counter'];
$news['date'] = $myrow['counter'];
}
$block['stories'][] = $news;
}
return $block;
}
Hope that helps, I'm not very good at explaining how to make code changes - I'm better at just doing it
Rowd