diff options
author | Derek Jones <derek.jones@ellislab.com> | 2011-10-06 00:36:22 +0200 |
---|---|---|
committer | Derek Jones <derek.jones@ellislab.com> | 2011-10-06 00:36:22 +0200 |
commit | 46715e5ca1451de2faa32b5866c37a40c8051423 (patch) | |
tree | bc9999b00164e039d37a602b89fb022ec4dd6f29 /user_guide_src/source/general | |
parent | e69b45663f06e84b3257fcd56616e299708599d1 (diff) |
fixing code spacing in Common and CLI docs
Diffstat (limited to 'user_guide_src/source/general')
-rw-r--r-- | user_guide_src/source/general/cli.rst | 18 | ||||
-rw-r--r-- | user_guide_src/source/general/common_functions.rst | 24 |
2 files changed, 32 insertions, 10 deletions
diff --git a/user_guide_src/source/general/cli.rst b/user_guide_src/source/general/cli.rst index e6f812570..8fcf31702 100644 --- a/user_guide_src/source/general/cli.rst +++ b/user_guide_src/source/general/cli.rst @@ -36,10 +36,18 @@ Let's try it: Hello World! Let's create a simple controller so you can see it in action. Using your text editor, create a file called tools.php, and put the following code -in it: +in it:: + + <?php + class Tools extends CI_Controller { + + public function message($to = 'World') + { + echo "Hello {$to}!".PHP_EOL; + } + } + ?> -<?php class Tools extends CI_Controller { public function message($to = -'World') { echo "Hello {$to}!".PHP_EOL; } } ?> Then save the file to your application/controllers/ folder. Now normally you would visit the your site using a URL similar to this:: @@ -49,11 +57,15 @@ Now normally you would visit the your site using a URL similar to this:: Instead, we are going to open Terminal in Mac/Lunix or go to Run > "cmd" in Windows and navigate to our CodeIgniter project. +.. code-block:: bash + $ cd /path/to/project; $ php index.php tools message If you did it right, you should see Hello World!. +.. code-block:: bash + $ php index.php tools message "John Smith" Here we are passing it a argument in the same way that URL parameters diff --git a/user_guide_src/source/general/common_functions.rst b/user_guide_src/source/general/common_functions.rst index 73b6bccb1..70563b8d2 100644 --- a/user_guide_src/source/general/common_functions.rst +++ b/user_guide_src/source/general/common_functions.rst @@ -14,7 +14,10 @@ supplied version_number. :: - if (is_php('5.3.0')) { $str = quoted_printable_encode($str); } + if (is_php('5.3.0')) + { + $str = quoted_printable_encode($str); + } Returns boolean TRUE if the installed version of PHP is equal to or greater than the supplied version number. Returns FALSE if the installed @@ -31,7 +34,14 @@ recommended on platforms where this information may be unreliable. :: - if (is_really_writable('file.txt')) { echo "I could write to this if I wanted to"; } else { echo "File is not writable"; } + if (is_really_writable('file.txt')) + { + echo "I could write to this if I wanted to"; + } + else + { + echo "File is not writable"; + } config_item('item_key') ========================= @@ -41,18 +51,18 @@ accessing configuration information, however config_item() can be used to retrieve single keys. See Config library documentation for more information. -show_error('message'), show_404('page'), log_message('level', -'message') -========== +show_error('message'), show_404('page'), log_message('level', 'message') +======================================================================== These are each outlined on the :doc:`Error Handling <errors>` page. set_status_header(code, 'text'); -================================== +================================ Permits you to manually set a server status header. Example:: - set_status_header(401); // Sets the header as: Unauthorized + set_status_header(401); + // Sets the header as: Unauthorized `See here <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html>`_ for a full list of headers. |