diff options
author | Derek Allard <derek.allard@ellislab.com> | 2008-01-19 00:19:41 +0100 |
---|---|---|
committer | Derek Allard <derek.allard@ellislab.com> | 2008-01-19 00:19:41 +0100 |
commit | 270c0aa7ba550cafb65629be3c38b27ea9012f67 (patch) | |
tree | 4168df99f84914cf582edfce1458fb927f11233e /user_guide | |
parent | 66f0724c3cdd2ea1de313bf407d40c38faf95b1d (diff) |
documentation for multiple views
Diffstat (limited to 'user_guide')
-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>
|