CodeIgniter Forums
How to structure my app? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: How to structure my app? (/thread-49358.html)



How to structure my app? - El Forum - 02-16-2012

[eluser]Mauricio de Abreu Antunes[/eluser]
Hello,

I have a controller here:
My index() method shows my view and print my 'notes'.
Ok, i wanna do a insert page now.

The right way is create a insert() method that calls a view note_insert_view with my form?
And where do i put my validation and controll insertion method?

insert_note($params) in my controller?


How to structure my app? - El Forum - 02-16-2012

[eluser]Aken[/eluser]
Form validation in controller, database insert in a model.


How to structure my app? - El Forum - 02-16-2012

[eluser]Mauricio de Abreu Antunes[/eluser]
Ok, i know. But:
i have index() showing my 'notes' (notes_view.php)
and insert () showing my form to insert new notes (notes_insert_view.php)
i need to build insert_note method in my controller, no? with validation and using insertNote model method?


How to structure my app? - El Forum - 02-16-2012

[eluser]Mauricio de Abreu Antunes[/eluser]
Any idea?


How to structure my app? - El Forum - 02-16-2012

[eluser]Aken[/eluser]
No, just do it in insert(). Follow the example on the Form Validation user guide page.


How to structure my app? - El Forum - 02-16-2012

[eluser]Mauricio de Abreu Antunes[/eluser]
Thank you, dude! Smile