[eluser]potion[/eluser]
Why can't my controller see the public var?
application/core/MY_Controller.php
Code:
<?php
class MY_Controller extends CI_Controller
{
public $template_data = array();
function construct()
{
parent::__construct();
$this->template_data['page_title'] = 'My Site';
$this->template_data['stylesheets'][] = 'css/styles.css';
$this->template_data['javascripts'][] = 'js/functions.js';
}
}
application/controllers/home.php
Code:
<?php
class Home extends MY_Controller
{
function index()
{
$this->template_data['page_title'] .= " - Home";
$this->template_data['body_id'] = "body_home";
$content_data['some_var'] = 'some data for the content view';
// Render View
$this->template_data['header_view'] = $this->load->view( 'header_view', '', true );
$this->template_data['content_view'] = $this->load->view( 'home/content', $content_data, true );
$this->template_data['footer_view'] = $this->load->view( 'footer_view', '', true );
$this->load->view( 'page_template_home', $this->template_data );
}
}
When I run it I get a PHP error:
Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined index: page_title
Filename: controllers/home.php
Line Number: 6
info: I'm updating from CI 1.6.3 to 2.1.0 - In 1.6.3 MY_Controller was an extension to Controller and resided in application/libraries - In 2.1.0 MY_Controller is an extension to CI_Controller and resides in application/core - I can't spot my faux pas... please verify.
Denis