Cameron
Cameron

Reputation: 28853

CakePHP Helper Question

What is difference between this:

$html->link

and

$this->Html>link

The first one works fine, but the second one always throws errors, but is used often in documentation over the first one. What is the difference?

Upvotes: 1

Views: 120

Answers (2)

dhofstet
dhofstet

Reputation: 9964

The second syntax is newer and was introduced with CakePHP 1.3.0: http://book.cakephp.org/view/1572/New-features-in-CakePHP-1-3#View-Helpers-1574. And you can use this syntax not only in other helpers as mentioned by kizzx2, but also in your views.

Getting errors with this syntax means you are using an old CakePHP version.

Upvotes: 0

kizzx2
kizzx2

Reputation: 19223

Use the first syntax to refer to the HTML helper in a view (like you normally would).

The second syntax is used to refer to the HTML helper in another helper. Example.

Upvotes: 2

Related Questions