CodeIgniter Forums
User profile page - 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: User profile page (/showthread.php?tid=20358)



User profile page - El Forum - 07-07-2009

[eluser]emilolsson[/eluser]
Hello all.

I use Dx Auth for user authentication. So the users can log-in and log-out etc. Now I would like to give every user their own profile page with the following URL structure:

http://doamin.com/profile/johndoe

But I don't understand how to get all the usernames in the last segment.

Anyone who can point me in the right direction?


User profile page - El Forum - 07-07-2009

[eluser]Michael Wales[/eluser]
Code:
$route['profile/([A-Za-z0-9-]+)'] = 'profile/view/$1'
URI Routing


User profile page - El Forum - 07-08-2009

[eluser]SteveBluck[/eluser]
Put this in your routes.php file

Code:
$route['profile/:any'] = "profile";

This means anything after the profile segment will go to the profile controller.

Then in your controller, you can do something like this

Code:
if($this->uri->segment(2) == TRUE)
{
    echo 'do something with the url';
}
else
{
    echo 'do something else if there is no second segment';
}

Hope this helps


User profile page - El Forum - 07-10-2009

[eluser]emilolsson[/eluser]
Thanks!