How to assign id and class using $ this-> Html-> link (..);?

echo $this->Html->link( 'more', array( 'controller'=>'posts', 'action'=>'view', $post['Post']['id'] ) ); 

How can I assign id and class for this binding / link? I want to override its css rule.

+6
source share
1 answer

HTML attributes can be specified in the array as the third parameter.

 echo $this->Html->link( 'more', array( 'controller'=>'posts', 'action'=>'view', $post['Post']['id'] ), array( 'id' => 'myId', 'class' => 'myClass' ) ); 

More information in Cookbook 2.x for version 2.x or Cookbook 1.3 for CakePHP 1.3.

+10
source

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


All Articles