@@ -37,7 +37,8 @@ Then save the file in your **app/Views** directory.
3737Displaying a View
3838=================
3939
40- To load and display a particular view file you will use the following code in your controller:
40+ To load and display a particular view file you will use the :php:func: `view() `
41+ function like following code in your controller:
4142
4243.. literalinclude :: views/001.php
4344 :lines: 2-
@@ -64,8 +65,10 @@ If you visit your site, you should see your new view. The URL was similar to thi
6465Loading Multiple Views
6566======================
6667
67- CodeIgniter will intelligently handle multiple calls to ``view() `` from within a controller. If more than one
68- call happens they will be appended together. For example, you may wish to have a header view, a menu view, a
68+ CodeIgniter will intelligently handle multiple calls to :php:func: `view() ` from
69+ within a controller. If more than one call happens they will be appended together.
70+
71+ For example, you may wish to have a header view, a menu view, a
6972content view, and a footer view. That might look something like this:
7073
7174.. literalinclude :: views/003.php
@@ -101,8 +104,8 @@ example, you could load the **blog_view.php** file from **example/blog/Views** b
101104Caching Views
102105=============
103106
104- You can cache a view with the `` view() `` function by passing a ``cache `` option with the number of seconds to cache
105- the view for, in the third parameter:
107+ You can cache a view with the :php:func: ` view() ` function by passing a ``cache ``
108+ option with the number of seconds to cache the view for, in the third parameter:
106109
107110.. literalinclude :: views/006.php
108111 :lines: 2-
@@ -116,7 +119,9 @@ along ``cache_name`` and the cache ID you wish to use:
116119Adding Dynamic Data to the View
117120===============================
118121
119- Data is passed from the controller to the view by way of an array in the second parameter of the ``view() `` function.
122+ Data is passed from the controller to the view by way of an array in the second
123+ parameter of the :php:func: `view() ` function.
124+
120125Here's an example:
121126
122127.. literalinclude :: views/008.php
@@ -142,8 +147,9 @@ Then load the page at the URL you've been using and you should see the variables
142147The saveData Option
143148-------------------
144149
145- The data passed in is retained for subsequent calls to ``view() ``. If you call the function multiple times
146- in a single request, you will not have to pass the desired data to each ``view() ``.
150+ The data passed in is retained for subsequent calls to :php:func: `view() `. If you
151+ call the function multiple times in a single request, you will not have to pass
152+ the desired data to each ``view() ``.
147153
148154But this might not keep any data from "bleeding" into
149155other views, potentially causing issues. If you would prefer to clean the data after one call, you can pass the ``saveData `` option
0 commit comments