CakePHP: find all records

$this->set('posts',$this->Post->find('all'));

Typically for an index action, like this (in the controller context):

Location: /app/controllers/posts_controller.php

<?php
class PostsController extends AppController{
     var $name = 'Posts';
 
     function index(){
         $this->set('posts',$this->Post->find('all'));
     }
}
?>
, , , ,

Leave a Reply

You must be logged in to post a comment.