1
yared
news by topic
  • 2006/10/28 15:45

  • yared

  • Just popping in

  • Posts: 14

  • Since: 2003/2/13


This code displays a listing of last news with date.
I want to do is that the news by topic
eg: the news of topic 1
I can do it?

PHP:
le="color: #000000"><?php $myts =& MyTextSanitizer::getInstance(); $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 created DESC"; $result = $xoopsDB->query($sql,5,0); while ( $myrow = $xoopsDB->fetchArray($result) ) { $news = array(); $title = $myts->makeTboxData4Show($myrow["title"]); if ( !XOOPS_USE_MULTIBYTES ) { if (strlen($myrow['title']) >= 100) { $title = $myts->makeTboxData4Show(substr($myrow['title'],0,(100 -1)))."..."; } } $xoopsTpl-> append('news', array( 'title' => $title, 'id' => $myrow['storyid'], 'date' => formatTimestamp($myrow['published'],"s") )); }


Template:
le="color: #000000"><?php <{foreach item=i from=$news}> <a href="<{$xoops_url}>/modules/news/article.php?storyid=<{$i.id}>"> <{$i.title}></a>&nbsp;(<{$i.date}>)<br> <{/foreach}>


example 1 (27 october)

Thank you

Translate: google

2
yared
Re: news by topic
  • 2006/10/29 13:07

  • yared

  • Just popping in

  • Posts: 14

  • Since: 2003/2/13


some idea?
Please help me.
this is for a special block, that spotlight exists but that does not work me for which I need.

Login

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits