Welcome Guest, Not a member yet? Register   Sign In
How to organize code for multiple purposes ?
#1

[eluser]majidmx[/eluser]
Hi All,
In my previous project with CI, I had different types of users [eg. Admin, Manager, User]
Admin manages everyone and Manager manages some users.
So they have interfaces for managing the users, also each user has his own [My Account] section to update his own information.
Also there is a signup page.
What I mean is all these funtionalities are basically the same, which is managing user.
The difference is showing/Hiding some fields and having some restrictions and so on. And sometimes validations are different.

The way I organized these was like this :

Code:
/controller/admin/account.php
/controller/admin/users.php
/controller/managers/account.php
/controller/managers/users.php
/controller/users/account.php
/controller/signup.php

and in each controller, functions for Update/Add/Edit.
But I feel that I'm doing it in the wrong way, because each time I want to ask a simple field to users table, I have to change all these files which is error-prone.

Can you give me your feedback about how can I overcome this in future projects ?
Do you think having a library for managing users will be a better way and just doing some settings in each file ?
Any idea is appreciated.

Thanks,
MajiD


Messages In This Thread
How to organize code for multiple purposes ? - by El Forum - 11-25-2008, 04:26 PM
How to organize code for multiple purposes ? - by El Forum - 12-02-2008, 05:43 PM



Theme © iAndrew 2016 - Forum software by © MyBB