diff options
Diffstat (limited to 'user_guide/general/views.html')
-rw-r--r-- | user_guide/general/views.html | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/user_guide/general/views.html b/user_guide/general/views.html index 83be4d4f0..5ad9fc5c0 100644 --- a/user_guide/general/views.html +++ b/user_guide/general/views.html @@ -113,8 +113,25 @@ class Blog extends Controller { <code>www.your-site.com/index.php/<var>blog</var>/</code>
+<h2>Loading multiple views</h2>
+<p>CodeIgniter will intelligently handle multiple calls to $this->load->view from within a controller. If more then one call happens they will be appended together. For example, you may wish to have a header view, a menu view, a content view, and a footer view. That might look something like this:</p>
+<p><code><?php<br />
+<br />
+class Page extends Controller {<br /><br />
+
+ function index()<br />
+ {<br />
+ $data['page_title'] = 'Your title';<br />
+ $this->load->view('header');<br />
+ $this->load->view('menu');<br />
+ $this->load->view('content', $data);<br />
+ $this->load->view('footer');<br />
+ }<br />
+<br />
+}<br />
+ ?></code></p>
+<p>In the example above, we are using "dynamically added data", which you will see below.</p>
<h2>Storing Views within Sub-folders</h2>
-
<p>Your view files can also be stored within sub-folders if you prefer that type of organization. When doing so you will need
to include the folder name loading the view. Example:</p>
|