08.10.2017 Views

codeigniter_tutorial

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CodeIgniter<br />

Change the code of application/controllers/test.php file as shown in the below.<br />

Loading the View<br />

The view can be loaded by the following syntax:<br />

$this->load->view('name');<br />

Where name is the view file, which is being rendered. If you have planned to store the<br />

view file in some directory then you can use the following syntax:<br />

$this->load->view('directory-name/name');<br />

It is not necessary to specify the extension as php, unless something other than .php is<br />

used.<br />

The index() method is calling the view method and passing the “test” as argument to<br />

view() method because we have stored the html coding in “test.php” file under<br />

application/views/test.php.<br />

<br />

Here is the output of the above code:<br />

12

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!