我想要这个html格式的代码
<a href="images/p191-large.jpg" class="cloud-zoom-gallery" rel="useZoom: 'zoom11', smallImage: 'images/p191.jpg' " title="Women's Crepe Printed Black">
<img class="zoom-tiny-image" itemprop="image" src="images/p191.jpg" width="80" height="97" alt=""/>
</a>
我已经在 cakephp 中编写了这段代码以获得上述结果
<?php
echo $this->Html->link(
$this->Html->image("p191.jpg", array(
"alt" => "Pant Suit",
"width" => "80",
"height" => "97",
'class' => 'zoom-tiny-image'
)),
array(
'controller' => 'admins',
'action' => '$this->Html->image(p191.jpg)'
),
array(
'class' => 'cloud-zoom-gallery',
'title' => 'Women\'s Crepe Printed Black',
'escape' => false,
'rel' => "useZoom: 'zoom11', smallImage: 'images/p191.jpg' "
)
);
?>
但将其作为输出
<a href="/stylishtailor1/admins/ ;image(p191.jpg)" class="cloud-zoom-gallery" title="Women's Crepe Printed Black" rel="useZoom: 'zoom11', smallImage: 'images/p191.jpg' ">
<img src="/stylishtailor1/images/p191.jpg" alt="Pant Suit" width="80" height="97" class="zoom-tiny-image" />
</a>
我该怎么做,请回复这个???
最佳答案
这是最接近您所需代码的代码:
<?php
echo $this->Html->link(
$this->Html->image('/images/p191-large.jpg', array('alt' => 'Pant Suit', 'width' => '80', 'height' => '97', 'class' => 'zoom-tiny-image')),
'images/p191-large.jpg',
array('class' => 'cloud-zoom-gallery', 'title' => 'Women\'s Crepe Printed Black', 'escape' => false, 'rel' => "useZoom: 'zoom11', smallImage: 'images/p191.jpg' ")
);
?>
要确保它正常工作,您必须检查两件事。图像路径(image()
函数的第一个参数)如果不在 webroot/img 下或者如果它在那里,则应该有完整路径,开始 /
可以省略。
要检查的第二件事是您的 url 位置(link()
函数中的第二个参数)。您也可以将其作为字符串或路由数组传递。在您的示例中,您传递了非常奇怪的数组。
关于php - 如何在 cakephp 的单个链接中添加两个或三个图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26930967/