i’ve looked into several opensource codeigniter website projects, and each seem to have their own design/development strategy at the application level. Was wondering, strictly respect to the code at the application level, if there are good strategies to follow? For example, for every request should be in its own controller file? Like if a user wants to login, have a separate controller and model that only handles that request? Basically in terms of just organizing application code, what are some effective strategies?
i’ve looked into several opensource codeigniter website projects, and each seem to have their
Share
CodeIgniter follows the principles of MVC (Model-View-Controller), although it practically gives you a lot of freedom to use it as you please.
In short, that’s what the different parts are supposed to do :
Example 1 :
HomeController is calledHomeController does any preparary work and loads the appropriate viewExample 2 :
Logincontroller is called$_POSTdata set? If not (it’s the first time the controller runs), then load the appropriate view (with the form in it – when the user ‘submits` the login form, the Login controller will be called again, with the username,password,etc set this time)logged_in) to the user’s ID.