1
Good day everyone! I'm working on setting up a custom block for the homepage of Xoops. With this block i'm wanting to show 5 articles from 1 category in the System News Module. I've got everything working right except for 1 piece.
I currently have 2 articles in "category1". Both of the articles are pulling the correct Title and Id's but it's showing the same article content (hometext) in both.
Now, bare with me i'm rather new to XOOPS and Php for that matter. The following code might not be the best way to do this...there might even be a module/block that i haven't found that will do this exact thing for me.
Any suggestions would be greatly appreciated!!
global $xoopsDB, $xoopsConfig, $xoopsUser, $xoopsModule, $xoopsModuleConfig, $HTTP_SERVER_VARS;
include_once XOOPS_ROOT_PATH.'/modules/news/class/class.newsstory.php';
$topicid = 2;
$query = "SELECT storyid, title, topicid, hometext FROM ".XOOPS_DB_PREFIX."_stories WHERE topicid='$topicid' ORDER BY storyid ASC";
$result = mysql_query($query);
$rows = mysql_num_rows($result);
$sarray = NewsStory::getAllPublished();
$scount = count($sarray);
for ( $i = 0; $i < $scount; $i++ ) {
$storyid = $sarray[$i]->storyid();
$storytext = $sarray[$i]->hometext();
}
while ($row = mysql_fetch_object($result))
{
if ( $row->topic=$topicid)
{
echo "
";
}
}