Cakephp 2.2 Blog Tutorial undefined constant errors
- by user1741925
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>