From d1097a1dc30f40c68bc4a5c89d3fadb295c55e56 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 1 Nov 2012 19:55:42 +0200 Subject: Allow use of dashes in controller/method URI segments Supersedes PR #642 --- user_guide_src/source/general/routing.rst | 6 +++--- user_guide_src/source/general/urls.rst | 27 +++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 7 deletions(-) (limited to 'user_guide_src/source/general') diff --git a/user_guide_src/source/general/routing.rst b/user_guide_src/source/general/routing.rst index 43c181669..e6174cc0d 100644 --- a/user_guide_src/source/general/routing.rst +++ b/user_guide_src/source/general/routing.rst @@ -162,8 +162,8 @@ appear by default. This route indicates which controller class should be loaded if the requested controller is not found. It will override the default 404 error page. It won't affect to the show_404() function, which will -continue loading the default error_404.php file at -application/errors/error_404.php. +continue loading the default *error_404.php* file at +*application/errors/error_404.php*. .. important:: The reserved routes must come before any wildcard or - regular expression routes. + regular expression routes. \ No newline at end of file diff --git a/user_guide_src/source/general/urls.rst b/user_guide_src/source/general/urls.rst index 6b390b559..20f80632a 100644 --- a/user_guide_src/source/general/urls.rst +++ b/user_guide_src/source/general/urls.rst @@ -28,9 +28,28 @@ approach, usually represent:: #. The third, and any additional segments, represent the ID and any variables that will be passed to the controller. -The :doc:`URI Class <../libraries/uri>` and the :doc:`URL Helper <../helpers/url_helper>` contain functions that make it -easy to work with your URI data. In addition, your URLs can be remapped -using the :doc:`URI Routing ` feature for more flexibility. +The :doc:`URI Class <../libraries/uri>` and the :doc:`URL Helper <../helpers/url_helper>` +contain functions that make it easy to work with your URI data. In addition, +your URLs can be remapped using the :doc:`URI Routing ` feature for +more flexibility. + +Friendly URLs +============= + +As you might guess, since there's a straight relationship between +URI segments and the controller/method pair that's being called, +those two determining segments must represent a valid class and +method name. +You may however also use dashes in the class/method-representing +segments, and they will automatically be translated to underscores +in order to be valid routed segments. + +For example:: + + example.com/my-settings/change-password/ + +The above example will route to the ``My_settings`` controller and +its method ``change_password()``. Removing the index.php file =========================== @@ -94,4 +113,4 @@ active. Your controllers and functions will then be accessible using the .. note:: If you are using query strings you will have to build your own URLs, rather than utilizing the URL helpers (and other helpers that generate URLs, like some of the form helpers) as these are designed - to work with segment based URLs. + to work with segment based URLs. \ No newline at end of file -- cgit v1.2.3-24-g4f1b