11-26-2011, 11:26 AM
[eluser]suntrop[/eluser]
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 …
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!
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 …
Code:
$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!