Welcome Guest, Not a member yet? Register   Sign In
Getting variable from uri into controller, then model, then view
#2

[eluser]ToddyBoy[/eluser]
After reading more about URI segments, I changed the controller to this.
Code:
function edit_listing()
{
    $id = $this->uri->segment(4);
    $this->load->model('lms/listings_model');
    $data['detail'] = $this->listings_model->edit($id);
    $this->load->view('lms/edit_listing', $data);
}

I didn't think I had to explicitly assign the URI segment to a variable to use it in the model. I thought that if I put a variable name when calling the function, it can be used.

Doesn't matter. The main thing is, it works and my head can now start to heal.


Messages In This Thread
Getting variable from uri into controller, then model, then view - by El Forum - 08-16-2010, 01:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB