Codeigniter
php frameworks, in the previous part of Views,
we talk about what is Views, and how to creating a view. Now I’m going to teach you about loading a view. To load a particular view file you
will use the following function, like this “ $this->load->view('name'); ”. Where name is the name of your view file. Note: The .php
file extension does not need to be specified unless you use something other
than .php. Now, open the controller file you
made earlier called blog.php, and replace
the echo statement with the view loading function:
If you visit your site using the using you did earlier you should
see your new view. The URL was similar to this, example.com/index.php/blog/. Codeigniter php frameworks was finished
talk about loading a view. Now let’s talk
about loading multiple views, codeigniter
will intelligently handle multiple calls to $this->load->view
from within a controller. If more than call happens they will be appended
together. For example, you may wish have a header view, a menu view, a content
view, and a footer view. That might look something like this:
Okay I think enough for this part 2 of Views. In this part we learn about loading a view and
loading multiple view. We will see you in the next part of Views in Codeigniter php frameworks.
This post of Codeigniter php frameworks: views part 2 is
references from http://codeigniter.com/user_guide/general/views.html.


Comments
Post a Comment