summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonatas Miguel <jonatas.df.miguel@gmail.com>2012-08-06 18:10:17 +0200
committerJonatas Miguel <jonatas.df.miguel@gmail.com>2012-08-06 18:10:17 +0200
commitcf168303ead21d1c8ad89af01458806e6be197fd (patch)
treed77b9c38d3b59c07034d3e0390c06728395c25a0
parent07264381020d730ebba9ae95688b73c25e523e54 (diff)
Updated documentation
-rw-r--r--system/core/Router.php2
-rw-r--r--user_guide_src/source/general/routing.rst10
2 files changed, 11 insertions, 1 deletions
diff --git a/system/core/Router.php b/system/core/Router.php
index 081468944..b11aa9ba5 100644
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -387,7 +387,7 @@ class CI_Router {
// Determine how many parameters the callback has.
$reflection = new ReflectionFunction($val);
- $param_count = count($reflection->getParameters());
+ $param_count = $reflection->getNumberOfParameters();
// Are there more parameters than matches?
if($param_count > $match_count)
diff --git a/user_guide_src/source/general/routing.rst b/user_guide_src/source/general/routing.rst
index 45950fc11..6bb5bdbc5 100644
--- a/user_guide_src/source/general/routing.rst
+++ b/user_guide_src/source/general/routing.rst
@@ -106,6 +106,16 @@ call the shirts controller class and the id_123 function.
You can also mix and match wildcards with regular expressions.
+Callbacks
+=========
+
+If you are using PHP >= 5.3 you can use callbacks in place of the normal routing
+rules to process the back-references. Example::
+
+ $route['products/([a-z]+)/edit/(\d+)'] = function($product_type, $id){
+ return "catalog/product_edit/" . strtolower($product_type) . "/" . $id;
+ };
+
Reserved Routes
===============