Welcome Guest, Not a member yet? Register   Sign In
TRUE contoller CRUD? Another way to not repeat myself?
#11

[eluser]Devon Lambert[/eluser]
[quote author="Mareshal" date="1268861473"]Devon, You can't reduce it too much. It's like you would want to buy a brand new car, with $10 and you still want it cheaper[/quote]

Hmmmm, I don't know Mareshal. I mean that must be one beat up car if it only drives in circles. :-)

Don't get me wrong, I love the way the code is flowing thus far, but I can blatantly see myself writing the same lines of code over and over again.

I've already thought around how to reduce the view code, but the controller code is what gets me. Surprised that this one isn't an easier fix is all. Which in now way means I dislike CI. I love CI more than any other framework out there.

Code:
$this->load->model('model_for_this_controller');

function add ('this_controller'){
  //reusable code to add my controller's item (i.e. page, site, theme)
  $this->model_for_this_controller->add($data);
  $this->load->view('success_page');
}

function edit ('this_controller'){
  //reusable code to edit my controller's item (i.e. page, site, theme)
  $this->model_for_this_controller->edit($data);
  $this->load->view('success_page');
}


function delete ('this_controller'){
  //reusable code to delete my controller's item (i.e. page, site, theme)
  $this->model_for_this_controller->delete($data);
  $this->load->view('success_page');
}


Messages In This Thread
TRUE contoller CRUD? Another way to not repeat myself? - by El Forum - 03-15-2010, 11:08 PM
TRUE contoller CRUD? Another way to not repeat myself? - by El Forum - 03-15-2010, 11:58 PM
TRUE contoller CRUD? Another way to not repeat myself? - by El Forum - 03-16-2010, 02:54 AM
TRUE contoller CRUD? Another way to not repeat myself? - by El Forum - 03-16-2010, 07:26 PM
TRUE contoller CRUD? Another way to not repeat myself? - by El Forum - 03-17-2010, 12:06 AM
TRUE contoller CRUD? Another way to not repeat myself? - by El Forum - 03-17-2010, 02:11 AM
TRUE contoller CRUD? Another way to not repeat myself? - by El Forum - 03-17-2010, 04:02 AM
TRUE contoller CRUD? Another way to not repeat myself? - by El Forum - 03-17-2010, 04:06 AM
TRUE contoller CRUD? Another way to not repeat myself? - by El Forum - 03-17-2010, 10:23 AM
TRUE contoller CRUD? Another way to not repeat myself? - by El Forum - 03-17-2010, 10:31 AM
TRUE contoller CRUD? Another way to not repeat myself? - by El Forum - 03-17-2010, 10:45 AM
TRUE contoller CRUD? Another way to not repeat myself? - by El Forum - 03-17-2010, 10:49 AM
TRUE contoller CRUD? Another way to not repeat myself? - by El Forum - 03-17-2010, 10:58 AM
TRUE contoller CRUD? Another way to not repeat myself? - by El Forum - 03-17-2010, 11:52 PM
TRUE contoller CRUD? Another way to not repeat myself? - by El Forum - 03-18-2010, 12:26 AM
TRUE contoller CRUD? Another way to not repeat myself? - by El Forum - 03-18-2010, 01:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB