doulu2591 2014-01-24 19:44
浏览 28
已采纳

图像作为分色链接在cakephp 2.x中

I have a gallery custom coded using cakePHP. Currently, I'm trying to get the pagination links for next and previous page to appear as images. The links work perfectly as text. In order to output them as simple text, I use the following code:

<?php   
echo $this->Paginator->prev();
echo $this->Paginator->next();      
?>

However, this outputs the links as text saying << Previous and Next >> respectively. I want to replace said output for images I have. I have looked around and found something that replaces the text for the image:

echo $this->paginator->prev($this->html->image('/images/icon_prev.png'), array('escape' => false));

However, it seems to break the link: While the link for the standard previous/next buttons go as:

http://galleryurlhere/albums/view/7/page:2

The new image link outputs them as:

http://galleryurlhere/albums/view/page:2

Thus failing to send the album ID as a variable and therefore breaking the pagination. Can anyone help me with this? I've tried overloading the function with the variable (Which I can access from the code), but that doesn't seem to be working. Any clue what I'm doing wrong?

  • 写回答

1条回答 默认 最新

  • douhui3760 2014-01-28 11:19
    关注

    This does not make much sense but the problem is in how you call the Helper.

    This does NOT work properly

    echo $this->paginator->prev( $this->html->image('/images/icon_prev.png'), array('escape' => false) );
    

    while this DOES: (note the capital "P")

    echo $this->Paginator->prev( $this->html->image('/images/icon_prev.png'), array('escape' => false) );
    

    More details

    It seems like $this->Paginator is not the same object as $this->paginator (spl_object_hash()). Similarly I would use $this->Html and not $this->html as my Html Helper.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作