summaryrefslogtreecommitdiffstats
path: root/user_guide/general/controllers.html
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2011-02-02 22:19:25 +0100
committerPhil Sturgeon <email@philsturgeon.co.uk>2011-02-02 22:19:25 +0100
commitd88b31550ae2aeb0e3bcc11ba82d4838f8a5fd31 (patch)
tree792bff97d41430b5c36a08c8ec3ac54db97375b6 /user_guide/general/controllers.html
parent5c59c7dc3254616b18057922ce012f22c18b147b (diff)
parent75f5ff5d99533a423e68686d89889d172c37d98e (diff)
Merged recent changes and tweaked multi-env changes.
Diffstat (limited to 'user_guide/general/controllers.html')
-rw-r--r--user_guide/general/controllers.html14
1 files changed, 11 insertions, 3 deletions
diff --git a/user_guide/general/controllers.html b/user_guide/general/controllers.html
index 1d9cd0328..91e700aba 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>
@@ -373,7 +381,7 @@ Previous Topic:&nbsp;&nbsp;<a href="urls.html">CodeIgniter URLs</a>
<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
Next Topic:&nbsp;&nbsp;<a href="reserved_names.html">Reserved Names</a></p>
-<p><a href="http://codeigniter.com">CodeIgniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006-2010 &nbsp;&middot;&nbsp; <a href="http://ellislab.com/">EllisLab, Inc.</a></p>
+<p><a href="http://codeigniter.com">CodeIgniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006 - 2011 &nbsp;&middot;&nbsp; <a href="http://ellislab.com/">EllisLab, Inc.</a></p>
</div>
</body>