I have a view called "portfolio_photos" that has multiple pages and utilizes the views mini pager. I have already overrode the view_mini_pager function so I can use images for the "previous" and "next" buttons. The other requirement by the client is that I need to display an image above the pager that changes depending on what page of the view is being displayed. So on the first and middle pages of the view it needs to display one image and then on the last page of the view it needs to display a different image.
What I've tried to do: Use the template.php variables that create the mini pager inside a custom views template to determine if I am on the last page of the view.
In my views-view--portfolio_photos.tpl.php file I have:
<div class="pager-title">
<?php if (empty($li_next)) {
print '<img src="images/last_page_pager_title.png" />';
}
else {
print '<img src="images/regular_pager_title.png">';
} ?>
</div>
The basic idea here is that if the $li_next variable is empty, then that means the last page of the view is being displayed because there is no next button. This is not working because apparently these variables are not available inside the custom views template.
Is there a way to pass these variables that are inside a template.php function to my custom views template? If not, how else can I determine if the last page of the view is being displayed?
The view in question can be found here at dev.drugcritics.com/portfolio
Thanks,
Dave
Comments
Since you are all ready
Since you are all ready overriding the mini-pager and the image goes directly above it, why not add the image there where you have the information?
The views_mini_pager function
The views_mini_pager function returns an item-list with 3 items - the previous button, the current page (e.g. 2 of 4), and the next button. How would I add an image to this list? I guess I don't completely understand how these functions work, but all I need to do is add an image to what the function is returning and my problem will be solved.
Here's the code I have in my template.php file for the views_mini_pager function:
image tag showing as text
Hey man , i was looking to put images in the pager buttons , and found your pager hook , but the images set as buttons shows as raw text , any idea why?
Thanks!!
H
ok problem solved! I added
ok problem solved!
I added another element to the items array called "pager_total" using the following code:
So now this element returned with the views_mini_pager function along with the "previous" and "next" buttons.