Revision e3815e78
Von Sven Schöling vor fast 12 Jahren hinzugefügt
SL/DB/Helper/Paginated.pm | ||
---|---|---|
114 | 114 |
|
115 | 115 |
Paginate will prepare information to be used for paginating, change the given |
116 | 116 |
args to use them, and return a data structure containing information for later |
117 |
display. |
|
117 |
display. See L<STRUCTURE OF PAGES> for information how the return is formatted.
|
|
118 | 118 |
|
119 | 119 |
C<args> needs to contain a reference to a hash, which will be used as an |
120 | 120 |
argument for C<get_all>. After C<paginate> the keys C<page> and C<per_page> |
... | ... | |
129 | 129 |
|
130 | 130 |
=back |
131 | 131 |
|
132 |
=head1 STRUCTURE OF PAGES |
|
133 |
|
|
134 |
The returned hashref will have the following structure: |
|
135 |
|
|
136 |
{ per_page => 20, # how many entries per page |
|
137 |
max => 5, # number of the last page |
|
138 |
cur => 2, # number of the current page |
|
139 |
common => [ # an array of hashes for each page |
|
140 |
..., |
|
141 |
{ active => 1, # set if this is the active page |
|
142 |
page => 2, # the string to display for this page |
|
143 |
visible => 1, # should this be displayed in the paginating controls |
|
144 |
}, |
|
145 |
... |
|
146 |
] |
|
147 |
} |
|
148 |
|
|
149 |
You may assume that C<cur> is sanitized to be within 1..C<max>. |
|
150 |
|
|
151 |
The common list is kept arbitrary by design, so that the algorithm to display |
|
152 |
the paginating controls can be changed by solely changing the |
|
153 |
C<make_common_pages> algorithm. If you need different glyphs for the pages or |
|
154 |
different boundaries, translate the C<page> entry for the page. |
|
155 |
|
|
156 |
The initial algorithm will show the following pages: |
|
157 |
|
|
158 |
=over 4 |
|
159 |
|
|
160 |
=item * |
|
161 |
|
|
162 |
1, 2, 3 |
|
163 |
|
|
164 |
=item * |
|
165 |
|
|
166 |
Last page |
|
167 |
|
|
168 |
=item * |
|
169 |
|
|
170 |
Current page +/- 5 pages |
|
171 |
|
|
172 |
=item * |
|
173 |
|
|
174 |
Current page +/- 10, 50, 100, 500, 1000, 5000 |
|
175 |
|
|
176 |
=back |
|
177 |
|
|
132 | 178 |
=head1 TEMPLATE HELPERS |
133 | 179 |
|
134 | 180 |
=over 4 |
Auch abrufbar als: Unified diff
Bessere Doku für das Zwischenformat des Paginated Helpers