I missed your post earlier, JFM... sorry
To make the topic separate you will need to add ', topicid ' to both of the sql statements, like this:
topic_title, topicid FROM
Then change the $topic_title and $topic lines to this:
$topic_title = $myts->makeTboxData4Show($myrow["topic_title"]);
$title = $myts->makeTboxData4Show($myrow["title"]);
$topic_id = $myrow["topicid"];
if ((strlen($title) + strlen($topic_title)) > $options[2]) {
$title = xoops_substr($title,0,$options[2]+3);
}
$news['topic_title'] = $topic_title;
$news['title'] = $title;
$news['topic_id'] = intval($topic_id);
$news['id'] = $myrow['storyid'];
By doing it this way it still uses the preference you set for restricting the length of the news title - the difference being that it uses that setting on topic and title, as one line.
Finally you will need to change the template news_block_new.html
Between the foreach lines, put this line:
<li><a href="<{$xoops_url}>/modules/news/index.php?storytopic=<{$news.topic_id}>"><{$news.topic_title}>a> :: <a href="<{$xoops_url}>/modules/news/article.php?storyid=<{$news.id}>"><{$news.title}>a> (<{$news.date}>)li>
If you want to add different styles to topic and title, assign a different class to each one, as dionesku outlined above.
If you don't want to have the topic name as a link, then just remove the "a" html tag - look online for html tutorials if you need help with that, there are tons of them and they explain it much better than I can.
Rowd
For reference, here's the whole function:
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, topicid 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, topicid 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 = $myts->makeTboxData4Show($myrow["title"]);
$topic_id = $myrow["topicid"];
if ((strlen($title) + strlen($topic_title)) > $options[2]) {
$title = xoops_substr($title,0,$options[2]+3);
}
$news['topic_title'] = $topic_title;
$news['title'] = $title;
$news['topic_id'] = intval($topic_id);
$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;
}