title: CakePHP check if user is logged in inside a view
body: <p>I have the following code:</p>
  
  <pre><code>    &lt;?php
  
      if (!$this-&gt;Auth-&gt;user())
      {
          echo $this-&gt;element('header');
      }
      else
      {
          echo $this-&gt;element('header-bar');
      }
  
      ?&gt;
  </code></pre>
  
  <p>inside my view which should show a different header for logged in users but throws the following error:</p>
  
  <pre><code>Notice (8): Undefined property: View::$Auth [APP/views/layouts/page.ctp, line 17]
  Fatal error: Call to a member function user() on a non-object in /Users/cameron/Sites/thehive/app/views/layouts/page.ctp on line 17
  </code></pre>
  
  <p>How do I fix this? Thanks</p>