|
Hi
i would like to add a feature to the 'latest posts' module. Where in the module we can choose a 'forum_id' where these posts are displayed from.
! before I go on I should state I have not made any components for Joomla before so am trying to get my head around the structure.
So far I have managed to add the parameter to mod_ccboard_latest_posts.xml -> <param type="text" name="ForumID" label="Forum_id" default="0" description="Select the Id of the forum you wish to display" class="ccboard" /> </param>
Now i think I need to extend JElement as mentioned here http://docs.joomla.org/Creating_custom_template_parameter_types
Could anyone tell me where the parameter 'numposts' is built for ccboard latest post module, as I can't seem to find it. If i could I feel it would give me enough of a clue to do the rest.
Beyond this is it then just a case of making changes to helper. I'm guessing something like this might put me in the right direction.
class ccboardLatestPostsHelper { function getItems($numposts, $forumid) { $user = &JFactory::getUser(); $db = &JFactory::getDBO();
if ( $numposts < 1) { return; }
if ($forumid == '0'){ $forumid = '%'
}
$db = &JFactory::getDBO(); $query = 'SELECT p.id, p.forum_id, p.topic_id, p.post_time, ' . 'p.post_subject, u.username, p.post_user, p.post_username ' . 'FROM #__ccb_posts AS p ' . 'INNER JOIN #__ccb_forums AS f ON f.id = p.forum_id ' . 'INNER JOIN #__users AS u ON u.id = p.post_user ' . 'WHERE f.published=1 AND f.view_for <= ' . $user->get('gid') . ' AND p.forumid = ' .$forumid.' ' . 'ORDER BY p.post_time DESC';
$db->setQuery($query, 0, $numposts); return ($items = $db->loadObjectList())?$items:array(); }
}
Thanks for any help you may be able to give. |