• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add/Edit froms with one view and invisible controllers

I noticed – as I wrote my edit() function – there are over 150 lines of code that are identical to the ones from my add() function. The view is almost the same as well. So, I want to use one view for my add and edit forms. This way seemed to be an easy way: http://ellislab.com/forums/viewthread/114016/#576706

But I don't know what the 'mock_item' model is for. And what is he doing with …
$data['item'] = $this->amodel->item($id);

I can't get my head around it, how this works :-)

Please, can anybody shed some light on it? Maybe a little more detailed description as xwero wrote.

Thanks a lot!

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.