summaryrefslogtreecommitdiffstats
path: root/user_guide_src
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2011-10-06 00:40:07 +0200
committerDerek Jones <derek.jones@ellislab.com>2011-10-06 00:40:07 +0200
commitaf8da30f5ef4420029fa71bef4d703192ccc3436 (patch)
tree9db3c224a2b882a13551c31e35ce3b03b67c35ea /user_guide_src
parent46715e5ca1451de2faa32b5866c37a40c8051423 (diff)
fixing code block spacing on caching, ancillary class, and alternative php docs
Diffstat (limited to 'user_guide_src')
-rw-r--r--user_guide_src/source/general/alternative_php.rst30
-rw-r--r--user_guide_src/source/general/ancillary_classes.rst14
-rw-r--r--user_guide_src/source/general/caching.rst6
3 files changed, 39 insertions, 11 deletions
diff --git a/user_guide_src/source/general/alternative_php.rst b/user_guide_src/source/general/alternative_php.rst
index 45c367131..4dc857a50 100644
--- a/user_guide_src/source/general/alternative_php.rst
+++ b/user_guide_src/source/general/alternative_php.rst
@@ -41,16 +41,36 @@ Alternative Control Structures
Controls structures, like if, for, foreach, and while can be written in
a simplified format as well. Here is an example using foreach::
- <ul> <?php foreach ($todo as $item): ?> <li><?=$item?></li> <?php endforeach; ?> </ul>
+ <ul>
+
+ <?php foreach ($todo as $item): ?>
+
+ <li><?=$item?></li>
+
+ <?php endforeach; ?>
+
+ </ul>
Notice that there are no braces. Instead, the end brace is replaced with
-endforeach. Each of the control structures listed above has a similar
-closing syntax: endif, endfor, endforeach, and endwhile
+``endforeach``. Each of the control structures listed above has a similar
+closing syntax: ``endif``, ``endfor``, ``endforeach``, and ``endwhile``
Also notice that instead of using a semicolon after each structure
(except the last one), there is a colon. This is important!
-Here is another example, using if/elseif/else. Notice the colons::
+Here is another example, using ``if``/``elseif``/``else``. Notice the colons::
+
+ <?php if ($username == 'sally'): ?>
+
+ <h3>Hi Sally</h3>
+
+ <?php elseif ($username == 'joe'): ?>
+
+ <h3>Hi Joe</h3>
+
+ <?php else: ?>
+
+ <h3>Hi unknown user</h3>
- <?php if ($username == 'sally'): ?>    <h3>Hi Sally</h3> <?php elseif ($username == 'joe'): ?>    <h3>Hi Joe</h3> <?php else: ?>    <h3>Hi unknown user</h3> <?php endif; ?>
+ <?php endif; ?>
diff --git a/user_guide_src/source/general/ancillary_classes.rst b/user_guide_src/source/general/ancillary_classes.rst
index 29f176004..f7c87011b 100644
--- a/user_guide_src/source/general/ancillary_classes.rst
+++ b/user_guide_src/source/general/ancillary_classes.rst
@@ -17,7 +17,10 @@ object.
Normally, to call any of the available CodeIgniter functions requires
you to use the $this construct::
- $this->load->helper('url'); $this->load->library('session'); $this->config->item('base_url'); etc.
+ $this->load->helper('url');
+ $this->load->library('session');
+ $this->config->item('base_url');
+ // etc.
$this, however, only works within your controllers, your models, or your
views. If you would like to use CodeIgniter's classes from within your
@@ -30,12 +33,17 @@ First, assign the CodeIgniter object to a variable::
Once you've assigned the object to a variable, you'll use that variable
*instead* of $this::
- $CI =& get_instance(); $CI->load->helper('url'); $CI->load->library('session'); $CI->config->item('base_url'); etc.
+ $CI =& get_instance();
+
+ $CI->load->helper('url');
+ $CI->load->library('session');
+ $CI->config->item('base_url');
+ // etc.
.. note:: You'll notice that the above get_instance() function is being
passed by reference::
- $CI =& get_instance();
+ $CI =& get_instance();
This is very important. Assigning by reference allows you to use the
original CodeIgniter object rather than creating a copy of it.
diff --git a/user_guide_src/source/general/caching.rst b/user_guide_src/source/general/caching.rst
index 8cc8e5c7a..bf6ed50f6 100644
--- a/user_guide_src/source/general/caching.rst
+++ b/user_guide_src/source/general/caching.rst
@@ -41,9 +41,9 @@ The above tag can go anywhere within a function. It is not affected by
the order that it appears, so place it wherever it seems most logical to
you. Once the tag is in place, your pages will begin being cached.
-**Warning:** Because of the way CodeIgniter stores content for output,
-caching will only work if you are generating display for your controller
-with a :doc:`view <./views>`.
+.. important:: Because of the way CodeIgniter stores content for output,
+ caching will only work if you are generating display for your controller
+ with a :doc:`view <./views>`.
.. note:: Before the cache files can be written you must set the file
permissions on your application/cache folder such that it is writable.