• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Loading a controller through an automatic condition

#1
Hello everyone,

I have this problem, I have the same app that is being used by different entities, but I need to load different methods based on the user.

So, let's take this as an example:

User A is from California.
User B is from Minnesota.
User C is from Mexico.

User A have a specific way of displaying the user profile based on information that is available to him and only to him.

What I need is to have the three of them call the /users/profile/$id method, but CodeIgniter should check first if there exists a /a/users/profile/$1 before loading. It if exists, then load that, else load the default method.

Doing this on a regular condition (if else) is not an option because that would be a pain when there are over 70 users.

I know wireddesignz already does this with his modular expansion library, but I have no idea of how to achieve it.

Please help.

Thanks.
Reply

#2
If you use an Auth system then you could link the users profile with the user information in the database.

user table:
user_id

When you create a new user then assign the user_id to the profile_id then you can add all the profile information that you need for that user at any time.

profile table
profile_id

Then you could store all the profile information using the user_id
What did you Try? What did you Get? What did you Expect?

Joined the CodeIgniter Community in 2009.          ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.