summaryrefslogtreecommitdiffstats
path: root/user_guide/general/controllers.html
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2011-01-27 13:08:38 +0100
committerPhil Sturgeon <email@philsturgeon.co.uk>2011-01-27 13:08:38 +0100
commitf00191c02985fba1e360a22ad914c547696df1b2 (patch)
tree76c2d963be0b7c70705369ca4a9f82946df8bba8 /user_guide/general/controllers.html
parent5dd84d04294b622f8b85f8aaac54d8329a2ae173 (diff)
parent3bb336cf1c55584bb92ed32563a9543ec7f01574 (diff)
Automated merge with http://hg.ellislab.com/CodeIgniter-Reactor
Diffstat (limited to 'user_guide/general/controllers.html')
-rw-r--r--user_guide/general/controllers.html12
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>
&nbsp;&nbsp;&nbsp;&nbsp;}<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 />
+&nbsp;&nbsp;&nbsp;&nbsp;$method = 'process_'.$method;<br />
+&nbsp;&nbsp;&nbsp;&nbsp;if (method_exists($this, $method)<br />
+&nbsp;&nbsp;&nbsp;&nbsp;{<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return call_user_func_array(array($this, $method), $params);<br />
+&nbsp;&nbsp;&nbsp;&nbsp;}<br />
+&nbsp;&nbsp;&nbsp;&nbsp;show_404();<br />
+}</code>
<a name="output"></a>