Welcome Guest, Not a member yet? Register   Sign In
Can Any body give me explanation and example for function _remap() and function _output() ?
#3

[eluser]toopay[/eluser]
Welcome to CI forum, Mario "St.Peter" Valentino.

To re-route the given url, is one of _remap main job, just like @PhilTem try to describe above. Just to make it more straight forward, _remap is similar with the usage of __call (magic method in PHP). So you could utilize it more, than just doing re-routing. Eg for some REST application, you could have just one controller, to act as a single gateway. You could also use _remap, to distinct whether a controller method is accessible or not, via some request. Or, even to create a Controller Factory, if you have some base controller. You will need this _remap, mostly, if you feel you are sharing several method (for example, you consistenly have to set a same session value, or you consistenly have to load same view file with similar data structure to send) accross your controller(s).

_output, is a method that, if it exists in your controller, then the output class will send the final output to these method. This will handy, if you want to filtering your content, in spesific controller and not applied to all controller(s). Eg, you have a blog, and in Post controller, you want to filter your content, to replace all external links with your own internal links using some regular expression pattern (so you could monitoring your reader condition, like what link attract them to leave your blog, etc). Combined with base controller concept, and _remap, this method could creating a reusable and consistent templating logic, within your application.


Messages In This Thread
Can Any body give me explanation and example for function _remap() and function _output() ? - by El Forum - 03-02-2012, 09:31 PM



Theme © iAndrew 2016 - Forum software by © MyBB