我有一个表,其中有一列“已读”。我希望能够从图形而不是文本进行排序,尽管似乎无法解决。
这是我尝试过的:
<!-- 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
最佳答案
您需要将转义选项添加到分页器/排序方法而不是 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>
关于cakephp - 对图像中的表格进行排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26738814/