[Newbie] How to organize my administration ? |
[eluser]xwero[/eluser]
You don't need to add parent::Controller(); to the index function. It goes in the constructor. The constructor has the same name as the class or __construct in php5+ classes. The constructor is only needed if you want to add things to the constructor of the extended controller. For example Code: class Admin extends Controller
[eluser]wiredesignz[/eluser]
Actually the constructor is required in PHP4 if you intend loading any other CI components. It initializes the parent Controller, which also extends CI_Loader and CI_Base. In PHP5 it is not required so much because PHP will call the parent::__construct() method automatically, even if you don't.
[eluser]koskoz[/eluser]
Ok guys, so here is the next problem : my control panel and my form are in my Admin class. So, the url is like that : http://myurl.com/admin Now, how do I manage the modules like news ? I have to do an other class for each module, but for the access when we are in the administration, and for the url ? Thanks.
[eluser]neen[/eluser]
What I did is I added some authentication checks to a __construct() function in each of my controllers. I have a separate controller for each area of administration section. I'm using a session variable to store the page that they loaded. If the user does not authenticate, I redirect them to a separate controller (/login) and the index of that controller is set to display the login form...once they are authenticated I then redirect them back to the page stored in the session variable I saved earlier.
[eluser]darknecromancer[/eluser]
i like this thread... give me some help about the architecture. |
Welcome Guest, Not a member yet? Register Sign In |