CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner: Re: [terrykhatri531] Need help to improve pagination: Edit Log


Jul 26, 2014, 2:27 PM

Views: 35951
Re: [terrykhatri531] Need help to improve pagination

Hi Terry,

Oh wow, you should break that single line of Perl code up so that its readable before you continue.

It looks like the foundations of what you need, but is far from a complete solution. The subroutine pageNumbers returns a list of values which are hardcoded, but you will need to programmatically generate these. The first, curr and last values can be gotten from Data::Page via the first_page, current_page and last_page accessor methods after instantiating the object with your known values, look at the synopsis, its a very straight forward module to use. The complicated bit will be working out what pages you want to display in between first / curr and curr / last, based on your design preferences and then testing that it works under different scenarios. The arguments $rate and $links look as though they were put in place as hints for this process.

Note that Data::Page isn't meant to be a complete pagination solution, it merely takes values you know i.e. total results, and calculates values you need to know i.e. total pages. Data::Pageset and Data::SpreadPagination are a little more in depth, in that they can be used to create the page navigation too, but I've never used and not sure if they can handle your exact design requirements.

Try and have a go at implementing yourself, start with a fresh script just to get your pagination working properly before implementing into your real world script, the base of it should be the code above. Hardcode the total results, results per page and current page number. If it works standalone then it is easier for us to run ourselves and advise you on issues. I don't have time right now to write up an example for you to work from, but am willing to work with you if you get something started.


(This post was edited by Zhris on Jul 26, 2014, 2:50 PM)

Edit Log:
Post edited by Zhris (Enthusiast) on Jul 26, 2014, 2:34 PM
Post edited by Zhris (Enthusiast) on Jul 26, 2014, 2:49 PM
Post edited by Zhris (Enthusiast) on Jul 26, 2014, 2:50 PM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives