1
stephenjacob
Custom Block for the News Module

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 
"
      
      "
;
        
echo 
"$row->title";

    if (
is_object($xoopsUser)) {
echo 
"[$row->storyid>Edit
 | $row->storyid>Delete]";
    }
    echo 
"$storytext
"
;

}
    }

2
stephenjacob
Re: Custom Block for the News Module

I appologize if this comes off wrong.. But what does one need to do to get any kind of responses around here? I know i'm very new to this community...But i was under the impression that this communnity was here to help.

Any suggestions would greatly appreciated..

Login

Who's Online

367 user(s) are online (54 user(s) are browsing Support Forums)


Members: 0


Guests: 367


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits