Welcome Guest, Not a member yet? Register   Sign In
User profile page
#1

[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?
#2

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

[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
#4

[eluser]emilolsson[/eluser]
Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB