[eluser]prashid[/eluser]
Hi,
I am new to CI and struggling to learn. I was checking Template Library Version 1.4.1 and downloaded it to use with CI 1.7.2.
Code:
Problem is template.php is loading but CONTENTS not filling. Below what I have done
1. /libraries/Template.php
Move to your application /libraries/ folder.
2. /config/template.php
Move to your application /config/ folder.
3. /views/template.php
Move to your application /views/ folder.
4. application/config/template.php //Added below code
$template['default']['regions'] = array(
'content',
);
5.application/views/basic.php //This code
<strong>Name:</strong> <?= $name ?>
6.application/views/fancy.php //This code
<strong>Fancy Name:</strong> <?= $name ?>
7.application/views/template.php //This code
<html>
<head>
</head>
<body>
<?= $content ?>
</body>
</html>
8.application/controller/basic.php //This code
<?php
class Basic extends Controller {
function Basic()
{
parent::Controller();
}
function index()
{
}
function show_name()
{
$this->load->library('template');
$data = array('name' => 'John');
$this->template->write('content', 'fancy', $data, 'basic');
$this->template->render();
}
}
?>
9. When I am trying to call show_name function using URL
http://localhost/ci_test/index.php/basic/show_name
I see in page view source below
<html>
<head>
</head>
<body>
<?= $content ?>
</body>
</html>
CONTENT not filling.
Any idea what is missing?