3
           
            
                
     
    
    News 1.2 beta has a block to diplay news per topic. I've send Mithrandir some code to put the option in the old blocks so 1 or more topics can be selected for each block. It uses a multi-select form. Little problem I couldn't figure out how to solve is: it gives each topic the name ARRAY. But that figures, I'm not a coder 

 . It works anyway.
If you don't mind hacking you news module a little, here is the code: (place this in modules/news/news_top.php, replace all.)
 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 FROM ".$xoopsDB->prefix("stories")." WHERE published < ".time()." AND published > 0 AND (expired = 0 OR expired > ".time().") ORDER BY ".$options[0]." DESC"; 
        } 
        else { 
            $sql = "SELECT storyid, title, published, expired, counter FROM ".$xoopsDB->prefix("stories")." WHERE published < ".time()." AND published > 0 AND (expired = 0 OR expired > ".time().") AND topicid in ".$topicpick." ORDER BY ".$options[0]." DESC"; 
            }    $result = $xoopsDB->query($sql,$options[1],0); 
    while ( $myrow = $xoopsDB->fetchArray($result) ) { 
        $news = array(); 
        $title = $myts->makeTboxData4Show($myrow["title"]); 
        if ( !XOOPS_USE_MULTIBYTES ) { 
            if (strlen($myrow['title']) >= $options[2]) { 
                $title = $myts->makeTboxData4Show(substr($myrow['title'],0,($options[2] -1)))."..."; 
            } 
        } 
        $news['title'] = $title; 
        $news['id'] = $myrow['storyid']; 
        if ( $options[0] == "published" ) { 
            $news['date'] = formatTimestamp($myrow['published'],"s"); 
        } elseif ( $options[0] == "counter" ) { 
            $news['hits'] = $myrow['counter']; 
        } 
        $block['stories'][] = $news; 
    } 
    return $block; 
} 
 
function b_news_top_edit($options) { 
    global $xoopsDB; 
    $form = ""._MB_NEWS_ORDER." ; 
    $form .= "n"; 
    $form .= "n"; 
    $form .= "n"; 
    $form .= " "._MB_NEWS_DISP." .$options[1]."' /> "._MB_NEWS_ARTCLS.""; 
    $form .= " 
"._MB_NEWS_CHARS." .$options[2]."' /> "._MB_NEWS_LENGTH.""; 
    $form .= "
test
; 
    include_once XOOPS_ROOT_PATH."/class/xoopsstory.php"; 
    $xt = new XoopsTopic($xoopsDB->prefix("topics")); 
    $alltopics = $xt->getTopicsList(); 
    $alltopics[0] = "All topics"; 
    ksort($alltopics); 
    $size = count($options); 
    foreach ($alltopics as $topicid => $topic) { 
        $sel = ""; 
        for ( $i = 2; $i < $size; $i++ ) { 
            if ($options[$i] == $topicid) { 
                $sel = " selected='selected'"; 
            } 
        } 
        $form .= ""; 
    } 
    $form .= ""; 
    return $form; 
}  
If you want to be certain everything works flawless, wait for the release of the new news module or use the Topics Block Module. But as far as I know you can only select 1 topic with that module. If that's enough, no need to use this code