Cakephp Helpers in Views and $ this

I am trying to determine what is the best standard for using helpers in views, should there be

echo $form->input();

or

echo $this->Form->input();

In CakePHP version 1.2, the helper class accesses the immediate helper object, while in book 1.3, the helper object is accessed through a view.

Is there any?

Leo

+3
source share
1 answer

It really matters only because of the possibility of a collision that will “destroy” your access to the assistant. Let's say I had a model with a name Form, and I decided to do something like this in my opinion after receiving many records.

foreach ($forms as $form) {
    echo $form['Form']['name'] . '<br/>';
}

, ? $form, FormHelper.

$this .

+6

Source: https://habr.com/ru/post/1794483/


All Articles