I am stuck on completing my first CI website. I need to get the comment counts and article category on my homepage. I have functions already in my models that retrieves this information but they all need an id passed in the function in order to retrieve the correct information for the articles. So I can retrieve both the comment count and category in my article view but I cannot on the homepage because the homepage contains multiple articles from various categories. I dont what addittional information I can post here but I will post my homepage controller and the getcomments model . Homepagefunction index()
{
$data['cats'] = $this->MCats->getTopCategories(); //we will replace soon!
$data['title'] = "Shout-Africa";
$data['main'] = 'public_home';
$data['featured'] = $this->MPosts->getAllFeaturedPosts();
$data['post'] = $this->MPosts->getAllActivePosts();
$data['comms'] = $this->MComments->getLatestComments();
$this->load->vars($data);
$this->load->view('newheader');
$this->load->view('newnav');
$this->load->view('newfeatured');
$this->load->view('newcontent');
$this->load->view('newvideo');
$this->load->view('newrightside');
$this->load->view('newwidget');
$this->load->view('footer');
} the getcomments model function getComments($postid){
$data = array();
$this->db->where('post_id',$postid);
$Q = $this->db->get('comments');
if ($Q->num_rows() > 0){
foreach ($Q->result_array() as $row){
$data[] = $row;
}
}
$Q->free_result();
return $data;
} Any help is appreciated.