From 270c0aa7ba550cafb65629be3c38b27ea9012f67 Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Fri, 18 Jan 2008 23:19:41 +0000 Subject: documentation for multiple views --- user_guide/general/views.html | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'user_guide/general') 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 { www.your-site.com/index.php/blog/ +

Loading multiple views

+

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:

+

<?php
+
+class Page extends Controller {

+ +    function index()
+   {
+      $data['page_title'] = 'Your title';
+      $this->load->view('header');
+      $this->load->view('menu');
+      $this->load->view('content', $data);
+      $this->load->view('footer');
+   }
+
+}
+ ?>

+

In the example above, we are using "dynamically added data", which you will see below.

Storing Views within Sub-folders

-

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:

-- cgit v1.2.3-24-g4f1b