2012-02-25 24 views
2

にクラスを追加私は、次のCakePHPのコードは、画像リンク

<?php echo $this->Html->image('products/'.$product['Product']['picture'],array('url'=>'/img/products/thumb.big.'.$product['Product']['picture'])); ?> 

に上記のコードを持っているfollwoing HTML生成:

<a href="/oscar-demo/cakephp/img/products/thumb.big.hs_2010_13_a_1920x1200_wallpaper.jpg"> 
    <img alt="" src="/oscar-demo/cakephp/img/products/hs_2010_13_a_1920x1200_wallpaper.jpg"> 
</a> 

をしかし、私はaにクラスを追加します。どうしたらいいですか?

答えて

2

あなたは、リンク内の画像を使用することができます。

echo $this->Html->link($this->Html->image('products/'.$product['Product']['picture']), '/img/products/thumb.big.'.$product['Product']['picture'], array('class' => 'css-class', 'escape' => false); 
0

私はstyle.cssにし、リンクされた画像内のクラスdeleteImgを作成しましたそのクラスに単純にクラスを適用しました。 ( 'controller' => 'MyCont'、 'action' => 'deletepic'、$ id)、array( '確認' => 'エコー$ this-> Html->本当に画像を削除しますか? '、' class '=>' deleteImg '));

関連する問題