php - 如何在 cakephp 的单个链接中添加两个或三个图像?

标签 php jquery html css cakephp

我想要这个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/

相关文章:

html - 网页底部出现滚动条

html - 是否有可能在没有 jqm 的情况下顺利更改移动页面?

php - 突变器不适用于批量插入

php - 使用 PHP 检查远程 FTP 服务器上的文件是否有重复内容

php - 无法在 PHP 中显示 MySQL 数据库中的图像,仅显示 ��n�ind���g�����Y�

javascript - 动画条变小

javascript - 如果 div B 为空则隐藏 div A

php - 使用 javascript 和 HTML 换行

jquery - 识别类中已更改的 id

javascript - 在列表之间单击时移动 li 项目无法正常工作