Welcome Guest, Not a member yet? Register   Sign In
extracting query information from the controller
#2

[eluser]gon[/eluser]
The controller doesn't know about $page_query, because you have assigned the data to $data['page_query']
Try:

Code:
function page() {
    $page_id = $this->uri->segment(3);
    $this->load->model('Page_model');
    $page_query = $this->Page_model->get_page($page_id);    
    // do whatever you need with $page_query
    $data['page_query'] = $page_query;  // and finally pass it to the view
    $this->load->view('main/generic', $data);
}

Perhaps you were confused by the "magic" that assigns the properties of the $data array to vars. This happens only in the view.


Messages In This Thread
extracting query information from the controller - by El Forum - 12-28-2007, 10:28 AM
extracting query information from the controller - by El Forum - 12-28-2007, 10:35 AM
extracting query information from the controller - by El Forum - 12-28-2007, 02:25 PM
extracting query information from the controller - by El Forum - 12-28-2007, 07:10 PM
extracting query information from the controller - by El Forum - 12-28-2007, 09:37 PM



Theme © iAndrew 2016 - Forum software by © MyBB