diff options
author | Pascal Kriete <pascal.kriete@ellislab.com> | 2010-12-15 16:51:37 +0100 |
---|---|---|
committer | Pascal Kriete <pascal.kriete@ellislab.com> | 2010-12-15 16:51:37 +0100 |
commit | 6c1d3fa35198c54c69e37aa74fa80723209c1d1e (patch) | |
tree | f7a42a7cad7acfef77b8bcb0e65d08d1c388eb5c | |
parent | 2fae66e54bac9104acb2236aeffec80d1c794c4d (diff) |
Small tweak to the _remap documentation (see #208).
-rw-r--r-- | user_guide/general/controllers.html | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/user_guide/general/controllers.html b/user_guide/general/controllers.html index 1d9cd0328..3a85ca38a 100644 --- a/user_guide/general/controllers.html +++ b/user_guide/general/controllers.html @@ -243,9 +243,17 @@ allowing you to define your own function routing rules.</p> }<br /> }</code> -<p>An array of leftover segments are passed into <kbd>_remap()</kbd> as an optional second parameter.</p> - +<p>Any extra segments after the method name are passed into <kbd>_remap()</kbd> as an optional second parameter. This array can be used in combination with PHP's <a href="http://php.net/call_user_func_array">call_user_func_array</a> to emulate CodeIgniter's default behavior.</p> +<code>function _remap($method, $params = array())<br /> +{<br /> + $method = 'process_'.$method;<br /> + if (method_exists($this, $method)<br /> + {<br /> + return call_user_func_array(array($this, $method), $params);<br /> + }<br /> + show_404();<br /> +}</code> <a name="output"></a> |