• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
program redirect of links

#7
(10-01-2015, 11:06 PM)slax0r Wrote:
(10-01-2015, 07:14 AM)mwhitney Wrote: You could also use a _remap() function in your controller to lookup the correct information and perform the redirect.

Not really in this case. If you visit id/2 and you do not have a controller named id and method named 2, the router will not know to which controller to route to, and fail to hit your _remap() in your base controller.

I wouldn't put a _remap() function in the base controller. In fact, I think that would be a bad idea, because most of my controllers have no need for a _remap(). I would create a controller named Id with a _remap() function to point it wherever the calls need to go. If I needed to remap more URLs than just those with 'id' in the first segment, I would make more controllers.

If this was a significant problem, I would create a library to rewrite the routes and override the router to load the library. However, that would be my last-ditch approach, as it indicates that all other attempts to fix the problem have failed.
Reply


Messages In This Thread
program redirect of links - by Andryshok - 09-30-2015, 11:25 PM
RE: program redirect of links - by InsiteFX - 10-01-2015, 03:48 AM
RE: program redirect of links - by Andryshok - 10-01-2015, 04:01 AM
RE: program redirect of links - by slax0r - 10-01-2015, 05:58 AM
RE: program redirect of links - by mwhitney - 10-01-2015, 07:14 AM
RE: program redirect of links - by slax0r - 10-01-2015, 11:06 PM
RE: program redirect of links - by mwhitney - 10-02-2015, 09:24 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.