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

このアンカー/リンクにIDとクラスを割り当てるにはどうすればよいですか?私はそのCSSルールをオーバーライドしたい。

答えて

10

HTML属性は、3番目のパラメータとして配列に指定できます。

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

2.xバージョンやCakePHPの1.3のためのCookbook 1.3ためCookbook 2.xで詳細情報。

+0

ありがとうございました。 –

関連する問題