Home > codeigniter > what is views in Codeigniter

what is views in Codeigniter

Basis

views are resposnsible for showing the final out as HTML page.Views are loaded in controller to work on.we can have multiple view files like header,footer,index etc.Below is a simple example of creating a view file.after creating save this in your application/views/ folder.

Ex

<html>
<head>
<title>creating view file</title>
</head>
<body>
<h1>It is my view file</h1>
</body>
</html>
//loading view file
<?php
class User extends Controller {
function index()
{
$this->load->view(‘user_view’);
}
}
?>
Outline
once the view file is done we should call like this under our controller.Now we can access the page in this path- example.com/index.php/user/
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment