4
Block controls what information get displayed, how the contents get displayed is up to template.
news bigstory block (news_bigstory.php)
function b_news_bigstory_show() {
global $xoopsDB;
$myts =& MyTextSanitizer::getInstance();
$block = array();
$tdate = mktime(0,0,0,date("n"),date("j"),date("Y"));
$result = $xoopsDB->query("SELECT storyid, title
FROM ".$xoopsDB->prefix("stories")." WHERE published >
".$tdate." AND published < ".time()." AND (expired >
".time()." OR expired = 0) ORDER BY counter DESC",1,0);
list($fsid, $ftitle) = $xoopsDB->fetchRow($result);
if ( !$fsid && !$ftitle ) {
$block['message'] = _MB_NEWS_NOTYET;
} else {
$block['message'] = _MB_NEWS_TMRSI;
$block['story_title'] =
$myts->makeTboxData4Show($ftitle);
$block['story_id'] = $fsid;
}
return $block;
}
?>
here is how it gets displayed (news_block_bigstory.html)
<p><{$block.message}>p>
<{if $block.story_id != ""}>
<p><a href="<{$xoops_url}>/modules/news/article.php?
storyid=<{$block.story_id}>"><{$block.story_title}>p>
<{/if}>
You can create a custom block without using a template.