URL simplification |
[eluser]jbads[/eluser]
Hi, Im wondering what my options are here. I am new to Code Igniter, I was just reading about URI routing in the user guide. My situation is this, I'm developing a site where users can join up and create profiles for themselves and would like to know the best way to give their profile a simplified address. For example www.mysite.com/profile/username Reading the routing guide set off a light bulb in my head ie. could something like this work in routes.php? $route['profile/$username'] = "blogs/users/$user_id"; It may be a long shot, if so what are my other optons? Thanks heaps, for any help you may offer Jake
[eluser]louis w[/eluser]
Why are you using profile in the url, but want to map it to a blog module? Why not just process everything in the profile constructor? Just curious. It could cause future confusion.
[eluser]jbads[/eluser]
That was just an example I took from the docs, I only changed the profile/variable and the variable in the value. Forget the Blog part. Bad example possibly, Im interested to know more about what you mean by "process everything in the profile constructor" in terms of what I can achieve according to my goal by "processing everything in the profile constructor".
[eluser]louis w[/eluser]
Check out "Remapping Function Calls" in the user guide. I always try to avoid routes if they are not needed just because its an extra thing to add to the complexity of a site. I would set up a profile controller and then add a _remap method then look the user up through that. http://ellislab.com/codeigniter/user-gui...#remapping
[eluser]jbads[/eluser]
Cool thanks, I'll look into it more, cheers for your help |
Welcome Guest, Not a member yet? Register Sign In |