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

[eluser]millo[/eluser]
hi,

i've been used to setting up the controller like such:

Code:
function page() {
    $page_id = $this->uri->segment(3);
    $this->load->model('Page_model');
    $data['page_query'] = $this->Page_model->get_page($page_id);
    $this->load->view('main/generic', $data);
}

this for example, would extract the page information which i then pass down into my view and access the information like so:

Code:
<?php $page_row = $page_query->row(); ?>
<h1>&lt;?php echo $page_row->page_title; ?&gt;</h1>
&lt;?php echo markdown($page_row->text); ?&gt;

i'm not sure however how to access the information that i need from within the controller before it get's passed to the view. for example ...

Code:
function page() {
    $page_id = $this->uri->segment(3);
    $this->load->model('Page_model');
    $data['page_query'] = $this->Page_model->get_page($page_id);
    // HERE I WANT TO ACCESS THE PAGE QUERY DATA, HOW DO I DO THAT?
    // I'VE TRIED PUTTING THE SAME CODE THAT'S USED IN THE VIEW BUT THAT DOESN'T WORK.
    $this->load->view('main/generic', $data);
}

I'm not really clear on how the array information is different from when it's in the controller to when it's in the view. If someone could point me in the right direction please?


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