I am trying to actually write a phpbb3 latest post module for J1.5
Steps to my approach
get a module skeleton to work and install. (thanks to the wiki and the 1.5 module hello world) done
Modify the helper.php to hold a basic SQL query that hits a hardcoded phpbb3 table in my joomla database and return it in a list
Not Done
Future load in all the neat parameters to make the module useful not even thinking there yet.
here is the problem, and it will most likely provide some of you with a chuckle but my function returns "Array" and nothing else
So here is the code
Code: Select all
class modHelloWorldHelper
{
/**
* Retrieves posts from phpbb3
*
* @param array $params An object containing the module parameters
* @access public
*/
function getPosts( $params )
{
global $mainframe;
$db =& JFactory::getDBO();
$query = 'SELECT phpbb_posts.post_subject,phpbb_posts.post_text' .
' FROM phpbb_posts' .
' WHERE phpbb_posts.post_approved = 1';
$db->setQuery($query, 0, 5);
$rows = $db->loadObjectList();
$i = 0;
$lists = array();
foreach ( $rows as $row )
{
$lists[$i]->text = htmlspecialchars( $row->phpbb_posts.post_subject );
$i++;
}
return $lists;
}
}
?>