[eluser]xare[/eluser]
Hello I have doubt.
Lets imagine I have a couple of controller classes. One called home and the other called contact.
There is a number of data that I want to pass to both controllers' views. For example the title of the page.
The way I know how to do it is by doing the following
file home.php
Code:
<?php
class Home extends Controller {
function Home(){
parent::Controller();
}
function index(){
$data['title']="Title"
$data['content']="Home Page";
$this->load->view('home',$data);
}
}
?>
Now I rewrite code for the contact controller
Code:
<?php
class Contact extends Controller {
function Contact(){
parent::Controller();
}
function index(){
$data['title']="Title"
$data['content']="Contact Page";
$this->load->view('contact',$data);
}
}
?>
Is there any way I can send the variable title to more than one view from a general controller. I mean when I load variables I want to be accessed by more than one view, where could I write them down so to not to copy the code in every controller?