php - codeigniter does not show default page title -



php - codeigniter does not show default page title -

when create dynamic titles codeigniter header, works ok, when there no title passed controller view, not show default title, shows "undefined variable: title". please check code below , help me find mistake.

controller:

function index() { $data['title'] = "dynamic title"; $this->load->view('header', $data); $this->load->view('layouts/home'); $this->load->view('footer'); }

view:

<title> <?php if ($title) { echo $title; } else { echo 'default title'; } ?> </title>

<title> <?php if (!empty($title)) { echo $title; } else { echo 'default title'; }

?>

php codeigniter title

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -