如何使用cakephp 1.3 html helper编写此代码?

如何使用cakephp 1.3 html helper编写此代码?,cakephp,cakephp-1.3,Cakephp,Cakephp 1.3,我尝试使用gallery Pretto,但我对这段代码有问题..如何使用cakephp html helper编写这段代码 <li><a href="images/fullscreen/2.jpg" rel="prettyPhoto[gallery1]"> <img src="images/thumbnails/t_2.jpg" width="60" height="60" alt="Nice building" /></a><

我尝试使用gallery Pretto,但我对这段代码有问题..如何使用cakephp html helper编写这段代码

<li><a href="images/fullscreen/2.jpg" rel="prettyPhoto[gallery1]">
        <img src="images/thumbnails/t_2.jpg" width="60" height="60" alt="Nice building" /></a></li>

  • 关键部分是关闭链接文本的HTML转义(因为它包含HTML图像标记)。此外,图像通常存储在路径中,如
    /img/…
    ,但这取决于您的实现

    <li><?php
    $thumb = $this->Html->image('images/thumbnails/t_2.jpg', array(
        'width' => 60,
        'height' => 60,
        'alt' => 'Nice building',
    ));
    echo $this->Html->link($thumb, 'images/fullscreen/2.jpg', array(
        'rel' => 'prettyPhoto[gallery1]',
        'escape' => false, // important
    ));
    ?></li>
    

  • 关键部分是关闭链接文本的HTML转义(因为它包含HTML图像标记)。此外,图像通常存储在路径中,如
    /img/…
    ,但这取决于您的实现

    <li><?php
    $thumb = $this->Html->image('images/thumbnails/t_2.jpg', array(
        'width' => 60,
        'height' => 60,
        'alt' => 'Nice building',
    ));
    echo $this->Html->link($thumb, 'images/fullscreen/2.jpg', array(
        'rel' => 'prettyPhoto[gallery1]',
        'escape' => false, // important
    ));
    ?></li>