title: Codeigniter Dynamic Page Title not working
body: <p>I looked around and found some threads that mentioned this, but for some reason when I add my page title to Public_Controller, which extends MY_Controller it does not work. If I don't add a page title to my other controllers that extend Public_Controller, then their page titles should be "Test Title". However, that is not the case. Here is what I have</p>
  
  <p>Public_Controller.php:</p>
  
  <pre><code>class Public_Controller extends MY_Controller
  {
  function __construct()
  {
      parent::__construct();
      $this-&gt;data['pageTitle'] = 'Test Title'; // pages without a title should display this
      ....
  }
  
  }
  </code></pre>
  
  <p>Home.php (my default controller...extends Public_Controller):</p>
  
  <pre><code>class Home extends Public_Controller {
  
  public function __construct() {
      parent:: __construct();
  }
  
  function index()
  { 
     $this-&gt;data['pageTitle'] = 'Your page title';
  
     $data['main_content'] = 'home';
  
     // My header which contains the &lt;title&gt; is in the template
     $this-&gt;load-&gt;view('includes/template', $data);
  }
  
  }
  </code></pre>
  
  <p>The above works if I do this as it should, but I want pages to display a title if they don't have this set:</p>
  
  <pre><code>$data['pageTitle'] = 'Your page title';
  </code></pre>
  
  <p>Header area:</p>
  
  <pre><code>&lt;title&gt;&lt;?php echo $pageTitle; ?&gt; &lt;/title&gt;
  </code></pre>
  
  <p>Any idea why this is not working?</p>