CodeIgniter Forums
Profile Pages with 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: Profile Pages with URL (/showthread.php?tid=18501)



Profile Pages with URL - El Forum - 05-08-2009

[eluser]breastfed[/eluser]
Hello,

i am trying to get Information about the following Situation.

I have a Login where User can register on the Page.
Now i want them to be available though: domain.com/username

How would i achieve this?

Thank you for help!


Profile Pages with URL - El Forum - 05-08-2009

[eluser]Michael Wales[/eluser]
URI Routing


Profile Pages with URL - El Forum - 05-08-2009

[eluser]Phil Sturgeon[/eluser]
Routing is the most simple method, but has a few problems. You'd need to restrict usernames to make sure there would never be any controller conflicts, which means right at the start of your app you have to think of every possible controller you might want to add in.

There is a good post on a few other methods of doing this here.


Profile Pages with URL - El Forum - 05-08-2009

[eluser]breastfed[/eluser]
Thank you Guys, i will follow the Thread in the Link.


Profile Pages with URL - El Forum - 05-08-2009

[eluser]drewbee[/eluser]
Personally I would rather create a subdirectory user and make all the available controllers in there.

Is it really that big of a deal between

site.com/franknbeans
and
site.com/user/franknbeans
?


Profile Pages with URL - El Forum - 05-08-2009

[eluser]Phil Sturgeon[/eluser]
[quote author="drewbee" date="1241809517"]Personally I would rather create a subdirectory user and make all the available controllers in there.

Is it really that big of a deal between

site.com/franknbeans
and
site.com/user/franknbeans
?[/quote]

You mean set up a route an have user/ as an extra namespace? Nobody is setting up controllers for each user here, that would be slightly insane.

This conversation should be continued in the link provided, people have gone over the pro's and con's to each method and explained its purpose.


Profile Pages with URL - El Forum - 05-08-2009

[eluser]drewbee[/eluser]
[quote author="Phil Sturgeon" date="1241812742"][quote author="drewbee" date="1241809517"]Personally I would rather create a subdirectory user and make all the available controllers in there.

Is it really that big of a deal between

site.com/franknbeans
and
site.com/user/franknbeans
?[/quote]

You mean set up a route an have user/ as an extra namespace? Nobody is setting up controllers for each user here, that would be slightly insane.

This conversation should be continued in the link provided, people have gone over the pro's and con's to each method and explained its purpose.[/quote]

What? No. Not a route for each user. A controller for every user action as standard CI is used.

$route['user/:any:/:any'] = 'user/$2/$1';

/user/franknbeans/profile



remap would simply have to switch around the username and the method, then pass any further attributes in. Seems like it would be the most efficient method to me. No routing needed either.