Cake では、次のように image() に URL を追加できます。
$this->Html->image('image src...', array('url' => 'some address...');
出力は:
<a href="some address..."><img src="image src..." /></a>
です。
クラスやその他の属性をa
タグに追加するには?
Cake では、次のように image() に URL を追加できます。
$this->Html->image('image src...', array('url' => 'some address...');
出力は:
<a href="some address..."><img src="image src..." /></a>
です。
クラスやその他の属性をa
タグに追加するには?
echo $this->Html->link(
$this->Html->image($imageSrc, array(
'class'=>'class_of_image',
'height' => '50',
'width' => '100',
'alt' => 'awesome close-up of me eating pizza'
)),
array(
'controller' => 'your_controller',
'action' => 'the_action'
),
array(
'class' => 'class_of_anchor',
'escape' => false //to allow the image tag within the link
)
);
この部分の一部またはすべてを 1 行にまとめて構いませんが、StackOverflow の理由から、このようにすると読みやすくなります。