How to accomplish this > www.mysite.com/username/controller/function/id |
[eluser]jadebot[/eluser]
@ishmael Your solution is very elegant, just what I was looking for... but after testing it, there is a major problem: using a header(location: "controller/method") redirect will not work in the _remap() function because "controller/method" will reroute to "home" controller again! This will carry on in an infinite loop. I have illustrated the problem based on workflow. Workflow for your method: 1. Main URI request is sent ... www.mysite.com/username/controller/method 2. Router reroutes request to home controller 3. Home controller fetches username, does work, and redirects to "any other URI" 4. URI is picked up by router; sends to home controller! Workflow for my method: 1. Main URI request is sent ... www.mysite.com/username/controller/method 2. Pre_system hook is triggered and calls function get_user_db() 3. get_user_db fetches username from URI, does work, and then completes. 4. Main URI is picked up by router where username is dismissed and routes to appropriate controller/method (fetched from URI) I would love to use your method as its so much cleaner, but it seems that these steps need to be executed in a specific order. Thanks for your help. Any thoughts on improving your method? If there is a way to call a controller from within a controller, that might work, else we are stuck. @Psychonax Please do tell how more than one can controller can be used from within another controller!? |
Welcome Guest, Not a member yet? Register Sign In |