[eluser]Taff[/eluser]
Hey.
I'm passing a couple of variables to a view using
Code:
$this->load->view('default_view',$data);
of which one variable is a title
Code:
$data['title']="This is the title";
which works fine if I assign in the function (index() in this case)
but I would like to set a default title in the constructor (I think it's called the constructor)
Code:
class Task extends Controller {
function Task()
{
parent::Controller();
$this->load->model('/taskmodel','model');
$data['title']="cool";
}
function index(){
$data['tasks']=$this->model->get_tasks($this->user_id,0);
//Doesn't send $data['title'] to the view
$this->load->view('tasks/default_view',$data);
}
}
I would have expected it to work...but I expect everything to work until I try it.
Am I doing something wrong, is it not possible, or is there a workaround (I thought maybe $data['title']=$this->config->item("cool")
Thanks for any help,
Taff