From 8ede1a2ecbb62577afd32996956c5feaf7ddf9b6 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Wed, 5 Oct 2011 13:34:52 -0500 Subject: replacing the old HTML user guide with a Sphinx-managed user guide --- user_guide_src/source/general/urls.rst | 88 ++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 user_guide_src/source/general/urls.rst (limited to 'user_guide_src/source/general/urls.rst') diff --git a/user_guide_src/source/general/urls.rst b/user_guide_src/source/general/urls.rst new file mode 100644 index 000000000..296271ed9 --- /dev/null +++ b/user_guide_src/source/general/urls.rst @@ -0,0 +1,88 @@ +################ +CodeIgniter URLs +################ + +By default, URLs in CodeIgniter are designed to be search-engine and +human friendly. Rather than using the standard "query string" approach +to URLs that is synonymous with dynamic systems, CodeIgniter uses a +**segment-based** approach:: + + example.com/news/article/my_article + +.. note:: Query string URLs can be optionally enabled, as described + below. + +URI Segments +============ + +The segments in the URL, in following with the Model-View-Controller +approach, usually represent:: + + example.com/class/function/ID + + +#. The first segment represents the controller **class** that should be + invoked. +#. The second segment represents the class **function**, or method, that + should be called. +#. The third, and any additional segments, represent the ID and any + variables that will be passed to the controller. + +The :doc::doc:`URI Class <../libraries/uri>` and the `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. + +Removing the index.php file +=========================== + +By default, the **index.php** file will be included in your URLs:: + + example.com/index.php/news/article/my_article + +You can easily remove this file by using a .htaccess file with some +simple rules. Here is an example of such a file, using the "negative" +method in which everything is redirected except the specified items:: + + RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L] + +In the above example, any HTTP request other than those for index.php, +images, and robots.txt is treated as a request for your index.php file. + +Adding a URL Suffix +=================== + +In your config/config.php file you can specify a suffix that will be +added to all URLs generated by CodeIgniter. For example, if a URL is +this:: + + example.com/index.php/products/view/shoes + +You can optionally add a suffix, like .html, making the page appear to +be of a certain type:: + + example.com/index.php/products/view/shoes.html + +Enabling Query Strings +====================== + +In some cases you might prefer to use query strings URLs:: + + index.php?c=products&m=view&id=345 + +CodeIgniter optionally supports this capability, which can be enabled in +your application/config.php file. If you open your config file you'll +see these items:: + + $config['enable_query_strings'] = FALSE; $config['controller_trigger'] = 'c'; $config['function_trigger'] = 'm'; + +If you change "enable_query_strings" to TRUE this feature will become +active. Your controllers and functions will then be accessible using the +"trigger" words you've set to invoke your controllers and methods:: + + index.php?c=controller&m=method + +**Please 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. -- cgit v1.2.3-24-g4f1b From 9607e738fc65f0dc3b70be810c6d2c3dc5060f87 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Wed, 5 Oct 2011 16:42:42 -0500 Subject: fixed code block spacing on URLs and Views general docs --- user_guide_src/source/general/urls.rst | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'user_guide_src/source/general/urls.rst') diff --git a/user_guide_src/source/general/urls.rst b/user_guide_src/source/general/urls.rst index 296271ed9..db1ffe565 100644 --- a/user_guide_src/source/general/urls.rst +++ b/user_guide_src/source/general/urls.rst @@ -42,9 +42,13 @@ By default, the **index.php** file will be included in your URLs:: You can easily remove this file by using a .htaccess file with some simple rules. Here is an example of such a file, using the "negative" -method in which everything is redirected except the specified items:: +method in which everything is redirected except the specified items: - RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L] +:: + + RewriteEngine on + RewriteCond $1 !^(index\.php|images|robots\.txt) + RewriteRule ^(.*)$ /index.php/$1 [L] In the above example, any HTTP request other than those for index.php, images, and robots.txt is treated as a request for your index.php file. @@ -74,7 +78,9 @@ CodeIgniter optionally supports this capability, which can be enabled in your application/config.php file. If you open your config file you'll see these items:: - $config['enable_query_strings'] = FALSE; $config['controller_trigger'] = 'c'; $config['function_trigger'] = 'm'; + $config['enable_query_strings'] = FALSE; + $config['controller_trigger'] = 'c'; + $config['function_trigger'] = 'm'; If you change "enable_query_strings" to TRUE this feature will become active. Your controllers and functions will then be accessible using the @@ -82,7 +88,7 @@ active. Your controllers and functions will then be accessible using the index.php?c=controller&m=method -**Please 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. +..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. -- cgit v1.2.3-24-g4f1b From 69116ed94140cb7eca7d3ae1068c045d267e3d6b Mon Sep 17 00:00:00 2001 From: purwandi Date: Fri, 7 Oct 2011 15:27:45 +0700 Subject: Fix CodeIgniter URLs on User Guide --- user_guide_src/source/general/urls.rst | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'user_guide_src/source/general/urls.rst') diff --git a/user_guide_src/source/general/urls.rst b/user_guide_src/source/general/urls.rst index db1ffe565..211537675 100644 --- a/user_guide_src/source/general/urls.rst +++ b/user_guide_src/source/general/urls.rst @@ -28,8 +28,7 @@ approach, usually represent:: #. The third, and any additional segments, represent the ID and any variables that will be passed to the controller. -The :doc::doc:`URI Class <../libraries/uri>` and the `URL -Helper <../helpers/url_helper>` contain functions that make it +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. @@ -56,13 +55,13 @@ images, and robots.txt is treated as a request for your index.php file. Adding a URL Suffix =================== -In your config/config.php file you can specify a suffix that will be +In your **config/config.php** file you can specify a suffix that will be added to all URLs generated by CodeIgniter. For example, if a URL is this:: example.com/index.php/products/view/shoes -You can optionally add a suffix, like .html, making the page appear to +You can optionally add a suffix, like **.html,** making the page appear to be of a certain type:: example.com/index.php/products/view/shoes.html @@ -75,7 +74,7 @@ In some cases you might prefer to use query strings URLs:: index.php?c=products&m=view&id=345 CodeIgniter optionally supports this capability, which can be enabled in -your application/config.php file. If you open your config file you'll +your **application/config.php** file. If you open your config file you'll see these items:: $config['enable_query_strings'] = FALSE; @@ -88,7 +87,7 @@ active. Your controllers and functions will then be accessible using the index.php?c=controller&m=method -..note:: If you are using query strings you will have to build +.. 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. -- cgit v1.2.3-24-g4f1b