从图像排序表

时间:2014-11-04 15:24:17

标签: cakephp

我有一张带有专栏的表格' read'。我希望能够从图形而不是文本中进行排序,尽管似乎无法解决问题。

以下是我尝试的内容:

        <!-- none of these work...-->

        <th class="read"><?php echo $this->Paginator->sort('read',$this->Html->image("read_no.png", array(
                    'width' => "26px",
                    'alt' => "Read",
                    array('escape' => false)))); ?></th>

        <th class="read"><?php echo $this->Html->link(
            $this->Html->image("read_no.png", array("alt" => "Read")),
            $this->Paginator->sort('read'),
            array('escape' => false)
        );?></th>

        <th class="read"><?php echo $this->Html->image("read_no.png", array(
                    'width' => "26px",
                    'alt' => "Read",
                    'url' => $this->Paginator->sort('read'),
                    array('escape' => false)
                )); ?>
        </th>

我收到的错误如下:

        The action <a href=" is not defined in controller

1 个答案:

答案 0 :(得分:2)

您需要将转义选项添加到Paginator / sort方法而不是HTML /图像方法:

<th class="read">
    <?php 
       $imageTag = $this->Html->image("read_no.png", array(
                                                         'width' => "26px",
                                                         'alt' => "Read",
                                                      )
                                      );
       echo $this->Paginator->sort('read', $imageTag, array('escape' => false)); ?>
 </th>