I'm trying to determine what the best standard is for using helpers in views whether is should be
echo $form->input();
or
echo $this->Form->input();
In the CakePHP manual ver 1.2 the Helper class is accessed by the helper object directly, whereas in the 1.3 book the helper object is accessed through the View.
Does this matter?
Leo
It really only matters because of the possibility of having a collision that will "wipe out" your access to the helper. Say I had a model named Form
and decided to do something like this in my view after getting many records.
foreach ($forms as $form) {
echo $form['Form']['name'] . '<br/>';
}
See what happened there? I accidentally just overwrote the $form
variable, basically losing my FormHelper
.
The standard is to now access all helpers via $this
in the view.