diff options
author | Derek Allard <derek.allard@ellislab.com> | 2008-05-27 23:45:59 +0200 |
---|---|---|
committer | Derek Allard <derek.allard@ellislab.com> | 2008-05-27 23:45:59 +0200 |
commit | 95d06605c68f9b2073b0a01e7fa81aad4aa0e755 (patch) | |
tree | 87003eb15ad7780e923bf1f59b69476362fa6d45 /user_guide/general | |
parent | 6d504e1928f8638fabbd1ead84ce140d9fabf237 (diff) |
added routing example
Diffstat (limited to 'user_guide/general')
-rw-r--r-- | user_guide/general/routing.html | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/user_guide/general/routing.html b/user_guide/general/routing.html index fca1e3b89..e6642fb04 100644 --- a/user_guide/general/routing.html +++ b/user_guide/general/routing.html @@ -108,7 +108,6 @@ the "catalog" class and the "product_lookup" method are instead used.</p> <p class="important"><strong>Note:</strong> Routes will run in the order they are defined.
Higher routes will always take precedence over lower ones.</p>
-
<h2>Examples</h2>
<p>Here are a few routing examples:</p>
@@ -119,10 +118,12 @@ Higher routes will always take precedence over lower ones.</p> <code>$route['blog/joe'] = "blogs/users/34";</code>
<p>A URL containing the segments blog/joe will be remapped to the "blogs" class and the "users" method. The ID will be set to "34".</p>
-
<code>$route['product/:any'] = "catalog/product_lookup";</code>
<p>A URL with "product" as the first segment, and anything in the second will be remapped to the "catalog" class and the "product_lookup" method.</p>
+<code>$route['product/(:num)'] = "catalog/product_lookup_by_id/$1";</code>
+<p>A URL with "product" as the first segment, and anything in the second will be remapped to the "catalog" class and the "product_lookup_by_id" method passing in the match as a variable to the function.</p>
+
<p class="important"><strong>Important:</strong> Do not use leading/trailing slashes.</p>
<h2>Regular Expressions</h2>
|