【问题标题】:Linking a small image to a bigger image in CakePHP在 CakePHP 中将小图像链接到大图像
【发布时间】:2016-06-21 15:51:02
【问题描述】:

我想要实现的是一个弹出窗口,当点击图像的较小版本时,应该显示较大的版本。

我知道我需要 jQuery 灯箱来执行此操作,但是如何在 CakePHP 中将小图像链接到大图像?

我正在使用 CakePHP 2.x - 下面是我的代码,但它不工作

<?php echo $this->Html->link($this->Html->image($proposal['Proposal']['supportedfileone'],array('width'=>'200','height'=>'100')), $this->Html->image($proposal['Proposal']['supportedfileone']));?>

【问题讨论】:

    标签: cakephp cakephp-2.0 cakephp-2.3


    【解决方案1】:

    对于第二张图片(实际尺寸的),你不应该使用 Html->图片,你不想显示它,你只需要给出图片的路径,作为链接。 不要忘记关闭链接中的字符转义,以便正确显示您的缩影。

    $this->Html->link(
        $this->Html->image(
            $proposal['Proposal']['supportedfileone'],
            array(
                'width'=>'200',
                'height'=>'100')),
        $proposal['Proposal']['supportedfileone'],
        array(
            'data-lightbox'=>'unique_name',
            'escape' => false));
    

    应该这样做!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-25
      • 2020-06-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-02
      • 2015-07-04
      相关资源
      最近更新 更多