Closed snopein closed 10 years ago
OH! Thank you very much, but why CodeIgniter Manual did not remind.
He should be added.
http://ellislab.com/codeigniter/user-guide/general/views.html
Let's try it with your controller file. Open it add this code:
<?php
class Blog extends CI_Controller {
function index()
{
$data['title'] = "My Real Title";
$data['heading'] = "My Real Heading";
$this->load->view('blogview', $data);
}
}
?>
Now open your view file and change the text to variables that correspond to the array keys in your data:
<html>
<head>
<title><?php echo $title;?></title>
</head>
<body>
<h1><?php echo $heading;?></h1>
</body>
</html>
CI V2.1.3 PHP V5.2.5
ERROR Notice
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: data