Undefined var when using Html Helper in CakePHP 2.0
cakephp, cakephp-2.0, php
Solution
From the manual of cakephp, it seems that `$html` should be `$this->Html` in CakePHP 2.0.
Problem
I am getting this error on my first attempt of CakePHP: Undefined variable: html [APP/View/Posts/index.ctp, line 13] I have version 2.0-alpha, have I got the wrong version or what has changed again. Seems it can't find the html helper. More info as requested: Here is the index.ctp file ``` <?php foreach ($posts as $post): ?> <?php echo $post['Post']['id']; ?> <?php ##line 13 here echo $html->link($post['Post']['title'], array('controller' => 'posts', 'action' => 'view', $post['Post']['id'])); ?> <?php echo $post['Post']['created']; ?> <?php endforeach; ?> ``` The data is definitely coming through but the error I get is this on line 13: Undefined variable: html [APP/View/Posts/index.ctp, line 13] Fatal error: Call to a member function link() on a non-object in /home I'm quite new I hope this helps. Update 5hrs later of going crazy Thanks guys it's sorted incase anybody has this problem the tutorial on the main site is an old one and nobody has made the effort to update it!! ...in the index.ctp example replace ``` $html->link(... ``` with ``` $this->Html->link(... ```