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 -

java - Parsing XML, skip certain tags -

c# - ASP.NET MVC Sequence contains no matching element -