CodeIgniter Forums
manage user profile url - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: manage user profile url (/showthread.php?tid=25902)



manage user profile url - El Forum - 12-30-2009

[eluser]davidino86[/eluser]
hi,

i'd like to manage the users profile page with a url like this:

Code:
www.mysite.com/auth/username

where the segment username is the nickname of the user logged in...


how can i set a controller like this?

thank you!


manage user profile url - El Forum - 12-30-2009

[eluser]rogierb[/eluser]
You can create an atuh controller and use the _remap() function to process the user.

Checkout the userguide for a (very) short example.

Another way is to use routing.
Code:
$route['auth/([a-z]+)'] = "auth/user/$1";

Where you map the username as a variable to a predefined method.


manage user profile url - El Forum - 12-30-2009

[eluser]davidino86[/eluser]
ok i'm goingo to try it....


if i well understand the real method of the controller 'auth' is 'user' and when i pass the username through an 'a href' the route ignores the username and pass variable and return the username info from the method 'user' in the controller 'auth', is it right?