Page title not working in codeigniter?
4 answers
Yes, it will work on the code. But only in this function.
Every time you create a controller, just create some kind of global variable so you can use it everywhere. See this code:
class Code extends CI_Controller {
var $TITLE = 'Welcome to codeigniter';
function Code(){
parent::__construct();
}
function index(){
$this->load->view('page');
}
}
And when you call this controller, you can use this variable anywhere in the controller, model, or view that is connected to that controller. Like this:
echo $this->TITLE;
0
source to share