[eluser]DumpProgrammer[/eluser]
here is the controller
Code:
function 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');
}
and here is the model
Code:
function getAllActivePosts(){
$data = array();
$this->db->limit(4);
$this->db->where('status', 'published');
$Q = $this->db->get('posts');
if ($Q->num_rows() > 0){
foreach ($Q->result_array() as $row){
$data[] = $row;
}
}
$Q->free_result();
return $data;
}
I hope that helps.