Cakephp 2.2 Blog Tutorial undefined constant errors

Posted by user1741925 on Stack Overflow See other posts from Stack Overflow or by user1741925
Published on 2012-10-13T09:31:49Z Indexed on 2012/10/13 9:37 UTC
Read the original article Hit count: 141

Filed under:

Have copy pasted the code from Blog tutorial in cakephp 2.2 but its not working. Getting the following errors. Notice (8): Use of undefined constant Html Notice (8): Use of undefined constant Form Notice (8): Use of undefined constant posts Notice (8): Use of undefined constant all Notice (8): Undefined index: all Below is the code for PostsController and index.ctp.

<?php
class PostsController extends AppController {
public $helpers = array(’Html’, ’Form’);

public function index() {

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

}

public function view($id = null) {
      $this->Post->id = $id;
      $this->set(’post’, $this->Post->read());
  }
}
?>

index.ctp
 <h1>Blog posts</h1>
 <table>
 <tr>
 <th>Id</th>
 <th>Title</th>
 <th>Created</th>
 </tr>
 <?php foreach ($posts as $post): ?>
 <tr>
 <td><?php echo $post[’Post’][’id’]; ?></td>
 <td>
 <?php echo $post[’Post’][’title’]; ?>
 </td>
 <td><?php echo $post[’Post’][’created’]; ?></td>
 </tr>
 <?php endforeach; ?>
 <?php unset($post); ?>
 </table>

© Stack Overflow or respective owner

Related posts about cakephp