Codeigniter Views Intro

Codeigniter Views : A view in codeigniter is a simple webpage which contains the html which is visible to the user.
Controller is responsible for loading the views or you can load view within a view.

Views are placed under the application/views folder.

Creating Codeigniter Views

Use editor and create the “my_view.php” in the views folder ie. application/views

<title>My Home Page</title>
<h1>Welcome to the home page.</h1>

<p>More Information Goes Here.......</p>


Loading Views

You Can Load Views As Below :


Note : You Need not to add “.php” while loading the view.

Now We Are going to load above view in

defined('BASEPATH') OR exit('No direct script access allowed');

class Myblog extends CI_Controller {
public function index(){






Try it »


Add Comment

📖 Read More