Wang Aocheng > HTML-Paging-SQL > HTML::Paging::SQL



Annotate this POD

View/Report Bugs
Module Version: 1.13   Source  


HTML::Paging::SQL - HTML pagination with SQL database


I think you can use this class in all platforms :)


        use HTML::Paging::SQL;

        my $hp = new HTML::Paging::SQL(
                all => your total amount of the record data£¬
                num => each page layout shows how many data it contains,

        my ($html,$start,$length) = $hp->number(
                sub => the pagination number is shown in each subsection,
                bicon => setting down the icon that moves forward£¬
                ficon => setting down the icon that moves backward,
                target => setting target for display window,

        my ($html,$start,$length) = $hp->single(
                first => set first page tag,
                previous => set previous page tag,
                next => set next page tag,
                last => set last page tag,
                split => set split tag,
                target => setting target for display window,


If you use the SQL database, this class can help you divide the page, support th e subsection show of pagination numbers, it is similar to the way shown in the Go ogle's(R) pagination. Under the minimal circumstance you only need to deliver a parameter, and you'll get the pagination result and can have the user-defined of icons jumping forwards or backwards.


HTML::Paging::SQL->new(all => ?, num => ?)

For example,according to this way to initialize the class, you should at least deliver a parameter named "all",which is the total amount of the data you want to show. They each express a subsection of the pagination number on each page.If you do not deliver, num is the default for 10, which means each page will show 10 data.

$hp->number(sub => ?, ficon => ?, bicon => ?, target => ?)

This method can transmit the HTML code with the digital format, among which num and sub can be separately chosen to deliver parameters, if sub isn't established,the result of the subsection show in page code will be closed; for example, sub is 4, you'll see the result similar to << 5 6 7 8 >> in the return html code. On the condition of a lot of data, it is of great use; in this way you can choose two parameters to establish the page number icons for jumping forwards or backwards. These two parameters are both "bicon" and "ficon". if you want to specify a target window for display, you can set "target" parameter. If they are not set up, the system will adopt "<<"AND">>" for tacit jump icons. After executing this method successfully, it will rebound 3 parameters;the 1st stands for the HTML code of page number,the 2nd for the limit first parameter in SQL,the 3rd for the limit second parameter in SQL.If the 2 nd and 3rd names stand for $start and $length, you can use it: "select * from table limit $start,$length".

$hp->single(first=>?, previous=>?, next=>?, last=>?, split=>?, target=>?)

This method is adopted as a format html code with the pagination mode of a single jump. All the options can be chosen. You can establish the four choices---first, previous, next and last---to specify the linking used language when the html code is exported; split is a division sign to set up the link of each jump; target can be specified for the linking target window of a pagination jump.


Wang Aocheng <>

English: Wang Zhonghua <>

syntax highlighting: