Welcome Guest, Not a member yet? Register   Sign In
a bit of logic help wanted
#3

[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.


Messages In This Thread
a bit of logic help wanted - by El Forum - 02-14-2010, 05:20 AM
a bit of logic help wanted - by El Forum - 02-14-2010, 12:10 PM
a bit of logic help wanted - by El Forum - 02-15-2010, 06:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB