16
Hey... thanks alot for the suggestion...
... i have also noticed that i made a simple but important mistake earlier... i neglected to add 'comments' to mySQL table grab ... so that the comments thing wasnt working properly...
so here is my updated code for my modified modules/news/blocks/news_top.php:
le="color: #000000"><?php ............ function b_news_top_show($options) { global $xoopsDB; $myts =& MyTextSanitizer::getInstance(); $block = array(); //should use 'topicid' for implementing News Topics in future $sql = "SELECT storyid, title, published, expired, counter, [b]hometext, bodytext, [u]nohtml, nosmiley, comments[/u][/b] 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][u]$news['text'] = $myts->makeTareaData4Show( $myrow['hometext'], !$myrow['nohtml'], !$myrow['nosmiley'], 1);[/u] if( $myrow['bodytext'] == "" ) { $news['readmore'] = ""; } else { $news['readmore'] = "Read More... | "; } [u]if( $myrow['comments'] == 0 ){ $news['comments'] = "Post Comment"; } else{ $news['comments'] = $myrow['comments']." Comment(s)"; }[/u] $news['id'] = $myrow['storyid']; $news['date'] = formatTimestamp($myrow['published'],"s"); $news['hits'] = $myrow['counter']; $block['stories'][] = $news; $block['numStory'] = $options[1]; }[/b] return $block; } .................
It includes the fix for displaying # of comments, and a better way than martyras's to show the html and smileys (where it depends on if you check the NO HTML or NO SMILEY options when creating a new story)
Not bad for someone who doesnt know php huh?
and also... i think a way we would be able to show the news topic in the title is to take the 'topicid' variable and also get data from some other MySQL table that has the topic names in it ... then with that we can show the topic names... but i know even lesser about SQL than php ... which is like less than nothing...
someone else who knows more about php and MySQL please help?