Can you tell me how to use a controller for home page because i’m trying to put a model’s data in home.ctp (homepage view) with
<?php $this->user->find() ?>but it returns
Notice (8): Undefined property:
View::$user [APP\views\pages\home.ctp,
line 1]
You should check out the cookbook; it has some solid CakePHP tutorials, at http://book.cakephp.org/
You haven’t really provided alot of information, but my guess is your Controller
usesa model ‘User’, and you’re putting$this->user->find()in your view, when it should be in your controller. In your controller’s action you’ll want/need to do something like this…You can then – in your View – access ‘users’ like so:
… since you used the Controller method
set()to send a variable$usersto the view.