CakePHP accessing other controllers

Posted by James on Stack Overflow See other posts from Stack Overflow or by James
Published on 2010-04-12T15:05:54Z Indexed on 2010/04/12 15:12 UTC
Read the original article Hit count: 158

Filed under:
|
|

CakePHP Newbie :)

I am having trouble accessing another controller and passing that data to a view in one of my controllers:

In controllers/landings_controller.php:

var $uses = 'User';

function home() {
    $userdata = $this->User->read();
    $this->set(compact('userdata'));
}

In views/landings/home.ctp:

<?php 
    echo $this->userdata;       
?>

When accessing /landings/home I get the following error:

Notice (8): Undefined property: View::$userdata [APP/views/landings/home.ctp, line 38]

I don't know what I am doing wrong. Any help? Thanks!

© Stack Overflow or respective owner

Related posts about cakephp

Related posts about php