14
Hey guys.... so i basically figured it all out for myself...
... i basically remade the Recent News block to look almost exactly like it would if your home page was the news module...
so heres the template for news_block_new.html ... which i edited (a clone) in the Template Manager in the admin ... no need to go edit the actual file and have to update the entire module...
<{foreach item=news from=$block.stories}>
<div class="item">
<div class="itemHead"><span class="itemTitle">
<a href="<{$xoops_url}>/modules/news/article.php?storyid=<{$news.id}>"><{$news.title}>a>
span>div>
<div class="itemInfo">
<span class="itemPostDate"><{$news.date}>span> (<span class="itemStats"><{$news.hits}> readsspan>)
div>
<div class="itemBody">
<{$story.imglink}>
<p class="itemText"><{$news.text}>p>
div>
<div class="itemFoot"><span class="itemPermaLink">
<a href="<{$xoops_url}>/modules/news/article.php?storyid=<{$news.id}>"><{$news.readmore}><{$news.comments}>a>
span>div>div><br />
<{/foreach}>
<hr>
<div style="text-align: right; margin: 10px;"><b><i><a href="<{$xoops_url}>/modules/news/">[Read More News]a>i>b>div>
...and here is my modified modules/news/blocks/news_top.php
// $Id: news_top.php,v 1.1 2004/01/29 14:45:49 buennagel Exp $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
...................
// ------------------------------------------------------------------------ //
function b_news_top_show($options) {
global $xoopsDB;
$myts =& MyTextSanitizer::getInstance();
$block = array();
$sql = "SELECT storyid, title, [b]hometext, bodytext,[/b] published, expired, counter FROM ".$xoopsDB->prefix("stories")." WHERE published < ".time()." AND published > 0 AND (expired = 0 OR expired > ".time().") 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;
[b] $news['text'] = $myts->displayTarea( $myrow['hometext'] );
if( $myrow['bodytext'] == "" ) {
$news['readmore'] = "";
} else {
$news['readmore'] = "Read More... | ";
}
if( $myrow['comments'] != 0 ){
$news['comments'] = (string)$myrow['comments']." Comment(s)";
} else{
$news['comments'] = "Post Comment";
}
$news['id'] = $myrow['storyid'];
$news['date'] = formatTimestamp($myrow['published'],"s");
$news['hits'] = $myrow['counter'];
$block['stories'][] = $news;
[/b] }
return $block;
}
.........................
return $form;
}
?>
... so its not totally complete.. i still have to add the news topic name to prefix the title area of each news post ...
...and a good advantage to this block is that it loads MUCH faster than if i had my start page as the news module... and you can also cache the block for better performance...
...i actually dont really know anything about php ... just clawing my way along ... so any comments/critique on the code is welcomed!