[eluser]Unknown[/eluser]
Hi
I'm new to CI.
I'm trying to find out if there's a way to render a single view for all methods of the same controller.
E.g.
not having to call
for each and every method. I want the methods to only add / modify the existing view data.
Following is some pseudo code showing what I want to achieve. Please show me how can this be done in CI?
Code:
<?php
class My_class extends Controller {
$data = array();
function My_class() {
parent::Controller();
$this->data['title'] = NULL;
}
function _output($output) {
// I want to use this same view for all methods
$this->load->view('my_view', $this->data);
}
function index() {
$this->data['title'] = 'Index';
}
function foo() {
$this->data['title'] = 'Foo';
}
function bar() {
$this->data['title'] = 'Bar';
}
}