[eluser]aslamdoctor[/eluser]
Hi Guys, here something that is been eating my mind from very long time and I decided to finally post it here and get some reviews.
Let me explain this by one example, this is the way I use CI:
Let's say we are building a whole User module, which will contain below features
1. Register
2. Login/Logout
3. Fortgot Password
4. Reset Password
5. Change Password
6. Update Profile
So for this what I do is
Step-1. I create a model named user_mode.php and write all create/update/delete/get functions in it. So manly the functions that does database related activities.
Step-2. I create a controller named user.php and write all the methods like register(), login(), logout()...and all other mentioned in above 6 points.
Step-3. And finally I create view files for all these controller methods like register_view.php, login_view.php, forgot_password_view.php
So this is the normal workflow I follow. But later on one day I was discussing to one of my friend who is also a CI Developer, and I told him this is how I work on CI. And he started laughing at me saying, you are doing it completely wrong.. So I asked him to show me how he uses CI and I found the only difference is, in Step-2, he creates a separate Controller file for every method like register.php, login.php, forgot_password.php...
And he said it is very productive flow. I am not sure this is the right way but it is a good idea to find it out through you guys, how you use it. And what should be the
most productive workflow to use CI, so that like this example, if I want to use the same user module on another project, I would be able to use it very quickly. If there is some other better workflow then this, please do post in your reply.
Thanks in advance for your valuable inputs.