Hello,

I recently installed cakePHP 2.0.5 and I'm trying to send variables
from my AppController to my default.ctp layout. (setting up some Auth
components)

However when I put the set in $this->set in the beforeFilter I receive
"Undefined variable" error. However when I add them to a beforeRender
function it works.

Am I doing something wrong? has this changed from Cake 1.3 to Cake
2.0.5?

AppController.php
//does not work
  public function beforeFilter() {
    $this->set('users_username', $this->_usersUsername());
    $this->set('logged_in', $this->_loggedIn());
    $this->Auth->allow('index', 'view');
  }

//works
  public function beforeRender() {
    $this->set('users_username', $this->_usersUsername());
    $this->set('logged_in', $this->_loggedIn());
}

default.ctp
<?php if($logged_in): ?>
    Welcome, <?php echo "$users_username"; ?> | <?php echo $this->Html-
>link('Logout', array('controller'=>'users', 'action'=>'logout')); ?>

Thanks!
mklappen

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to