[eluser]Naczu[/eluser]
Hi. I am newbie. I have problem. I use the latest version 2.1.2 of codeigniter. I have a controller which is start.php like this.
Code:
<?php
class Start extends CI_Controller
{
var $base;
var $css;
function Start()
{
$this->base = $this->config->item('base_url');
$this->css = $this->config->item('css');
}
function hello($name = 'Guest')
{
$data['css'] = $this->css;
$data['base'] = $this->base;
$data['mytitle'] = 'Welcome to this site';
$data['mytext'] = "Hello, $name, now we're getting dynamic!";
$this->load->view('testview', $data);
}
}
and testview.php file is
Code:
<html>
<head>
<title>Web test Site</title>
<link rel="stylesheet" type="text/css" href="<?php echo
$base."/".$css;?>">
</head>
<body>
<h1><?php echo $mytitle; ?> </h1>
<p class='test'> <?php echo $mytext; ?> </p>
</body>
</html>
and in config.php
Code:
$config['base_url'] = 'http://localhost/codeigniter/';
$config['css'] = 'css/style.css';
I got this error...
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Start::$config
Filename: controllers/start.php
Line Number: 8
Fatal error: Call to a member function item() on a non-object in C:\xampp\htdocs\codeigniter\application\controllers\start.php on line 8
where is the problem ???? Please help me