Page selection
|
griffinmt
![]()
Joined: 2009-09-06
Posts: 128 |
Posted: Sat, 2009-09-19 16:34
|
|
Not sure if this has already been covered, so forgive me if it is 'old stuff'. When navigating through any large sized albums, it would be nice to have more than just the First, Last, Next and Previous buttons to select on the thumbnails. In addition, it would be usefull to have a dropdown list of page numbers to allow you to select how far into an album you can jump. This is especially usefull when moving around from album to album as it would allow immediate movement down to a previous page that was being looked at. Would also be nice to display this on the thumbnail page as something like 'Page xx of yy'. Martyn T. Griffin |
|
| Login or register to post comments |


Posts: 11018
I haven't seen anyone post anything about this. This could easily be a specific theme modification. I'm not sure of the modification you'd make, but /themes/YourTheme/views/pager.html.php is where you'd make the change.
Should be easy to calculate the number of pages since you know where you're at
%from_numberand the total number on that page
%to_number minus %from_number plus 1and the total count
%count$from_to_msg = t2("Photo %from_number of %count", "Photos %from_number - %to_number of %count", $total_items, array("from_number" => $current_first_item, "to_number" => $current_last_item, "count" => $total_items)) ?>____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 128
Ok, thanks for the starting point. Is there a variable that represents either the # pics per page or the highest page number. $last_page seems to be blank?!
The problem occurs on the last page when it is not a full page, %to_number minus %from_number plus 1 does not work.
OK, $last_page has the correct last page number except for when you are on the last page, then it is empty and is used as the switch to prevent the Next and Last buttons from being shown!!
Can I add session variables at this point? I would save the $last_page value if this is the first page and when $last_page is empty, I could just pull it from the session.
Martyn T. Griffin
Posts: 11018
http://docs.kohanaphp.com/libraries/pagination
Unfortunately, not being a programmer myself, I tried messing around with that and couldn't get anywhere. I'd need some hand-holding to learn how that works.
Not sure why you want to save any data to the session.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 128
On the first page that is displayed, I want to save the number of the LAST page, because when the actual last page is shown, that page number is not actually available from any of the variables.
The following two images might show what I mean.
Image one is using information available in the supplied variables. Image two is is using the information available on the last page.
I was also planning on adding a dropdown list of all available page numbers so the user can navigate DIRECTLY to a specific page.
This is the rough code in pager.html.php to add this.
Martyn T. Griffin
Posts: 11018
http://docs.kohanaphp.com/libraries/pagination
<? echo($current_page); ?>
<? echo($total_pages); ?>
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 128
BINGO!
Those are the two (and only) values I really needed.
So tell me, if you are not a php programmer, just where do you find this info???
Thanks,
Martyn T. Griffin
Posts: 11018
trial and error, trial and error Plus I read the second line in pager.html.php that point to the Kohana docs, then read those (closer the 2nd time around)
I don't know about the same look and feel, that would be styling and I'm even worse there. www.google.com is my CSS reference
As for a drop down list, since you know the total number of pages it should be easy to either do a loop or something like that to populate a <select> tag with the correct data to create a drop down.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 128
That link is well worth saving!
And now I have taken a quick look, making alterations would seem to be a whole lot more straight forward than originally thought!
Thanks again,
Martyn T. Griffin
Posts: 11018
Yeah, customizing G3 is going to be sooo much easier and nicer than G2.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 12
Can someone post the complete code that needs to go into pager.html.php? I am a noobian to PHP and my skills are limited. I tried implementing some of what is above, but can't seem to figure it out. I am interested in getting the page numbers like griffinmt has on his site.
Thanks for any help!
Posts: 128
This was the code I added to pager.html.php inside MY theme, just before the line
<li class="g-txt-right">
Also in the css file I added this after the definition for
#g-content #g-album-grid {
The above 'evolved' so there is some redundancy in the css. Will thin it out when I have a chance.
This results in the appearance attached.
Martyn T. Griffin
Posts: 12
Thank you thank you thank you Martyn! Worked like a charm!
Posts: 12
Just one other question,
I put this code in the pager.html.php file, and it puts the page number selection at the bottom of the page. No matter how far in that pager file I put it (it is currently at the top) it still shows it at the bottom. I would also like to have it show at the top, just under my album title. Where would I put that code in? I am currently using the default theme.
Thanks again for your help! Great resource
Posts: 128
In album.html.php, locate the line:
at the bottom and move it up to the top right after the line:
In dynamic.html.php, locate that same line at the bottom and move it up to just before the line:
Martyn T. Griffin
Posts: 12
Once again Martyn, I am in your debt... Thank you very much! Looks great now!
Posts: 14
I think this is great, but what do I need to change to make this to work with the latest git version of the Gallery 3? There is not anymore pager.html.php now there is paginatior.html.php and this page selector doesn't work with it.
Thanks!