User subfolders like Twitter ? |
[eluser]Xeoncross[/eluser]
Here is how I do it in PHP. You can also do the same thing with htaccess and easier - I just haven't gotten around to it. Code: $route['controller/method/'] = "controller/method/"; It's a pain - but you have to set a route rule for each normal controller/method/+-uri_data/. I think you can also use regex in the routes - but I haven't looked into that.
[eluser]codecode[/eluser]
Again, what I need is a user registration process the way Twitter does it and after registration the user to have his/her space like http://mywebsite.com/userid. I'm not sure how this can be integrated with DX Auth library but that's what I'm trying to do and I need help with. I don't have any code written for this yet other than DX Auth library installed but I just need some advice (sample code) how this can be done (dynamically). When the user registration is complete the user space (i.e. http://mywebsite.com/userid ) is complete and only that user has access to the functions (like edit, add post etc) on that page (user space), again the way Twitter does it.
[eluser]xwero[/eluser]
You can make the routing simpler by only using the controllers instead of each normal route. Code: $route['(controller|controller2)(.*)'] = '$1$2'; Code: $route['[a-zA-Z0-9]+/(add|edit)'] = 'users/$1'; Code: class Users as Controller
[eluser]jwright[/eluser]
Thanks xwero, I think thats the cleanest solution I've seen or thought of... looks good. Good clean username urls
[eluser]jwright[/eluser]
here's a little modification to xwero's solution ... it's definately a hack but I'm thinking I won't have to remember to maintain the list of controllers. Code: $controllersDir = APPPATH."/controllers"; Use this code at your own risk. If I don't have any issues because of this code I'll run it in a production app. Otherwise, just hard coding the controllers isn't a big deal. I love doing stuff like this though. |
Welcome Guest, Not a member yet? Register Sign In |