cakephp - 对图像中的表格进行排序

标签 cakephp

我有一个表,其中有一列“已读”。我希望能够从图形而不是文本进行排序,尽管似乎无法解决。

这是我尝试过的:

        <!-- 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/

相关文章:

php - Cakephp - 包含(可包含行为)获取太多

php - 响应式设计 - 数据库生成的图标/图像

javascript - Cakephp,JQuery JCarousel Lite,错误

php - 在 CakePHP 中使用不同的 MySql DB 进行写入操作

php - CakePHP 不会按条件应用组

session - CakePHP:单个域上的多个安装;登录 session 共享问题

mysql - CakePHP mysql 数据库命名约定问题

mysql - 在 cakephp 中从一个模型连接两个模型

php - 将 utf8 unicode 字符串转换为 PHP 中的 uft8 general ci 而不是来自 MySQL

cakephp - 如何使用 $this->Html->link(..); 分配 ID 和类?