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?
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.