[eluser]prashid[/eluser]
I have below code for a simple layout but in the browser I don't see the OUTPUT. I have
$config['rewrite_short_tags'] = TRUE;
Thanks in advance.
Code:
Config file at the end
<?php
function __autoload($class)
{
if(strpos($class, 'CI_') !== 0)
{
@include_once( APPPATH . 'libraries/'. $class . EXT );
}
}
<?php
In Libraries folder
<?php
class MY_Controller extends Controller {
function MY_Controller ()
{
parent::Controller();
}
}
?>
<?php
class Public_Controller extends MY_Controller
{
function __construct()
{
parent::MY_Controller();
$this->load->library('template');
$this->template->set_theme('default');
//layout_test.html
$this->template->set_layout('layout_test');
$this->template->enable_parser(FALSE);
}
}
?>
<?php
class Admin_Controller extends MY_Controller
{
function __construct()
{
parent::__construct();
}
}
?>
application/themes/default/views/layouts/layout_test.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html >
<head>
<?= $template['title'] ?>
</head>
<body>
<div id="content">
<?= $template['body'] ?>
</div>
</body>
</html>
application/views/my_view.php
<html>
<head>
<title>Hello Anyone</title>
</head>
<body>
</body>
</html>
Calling from Browser
<?php
class Blog extends Public_Controller
{
function Blog()
{
parent::__construct();
$this->template->build('view_name');
$this->template->title('Some title')->build('view_name');
}
}
?>