1 <?php
defined('SYSPATH') OR die('No direct access allowed.');
2 if (!isset($_SESSION['_pagination_id_'])) {
3 $_SESSION['_pagination_id_'] = 1;
5 switch ($_SESSION['_pagination_id_']) {
7 $_SESSION['_pagination_id_'] = 2;
10 $_SESSION['_pagination_id_'] = 1;
13 $_SESSION['_pagination_id_'] = 1;
19 * Digg pagination style
21 * @preview « Previous 1 2 … 5 6 7 8 9 10 11 12 13 14 … 25 26 Next »
23 if (!empty($total_items)) {
24 $label_previous = '<span class="icon-16 x16-arrow-left" title="'._('Previous').'"></span>';
25 $label_next = '<span class="icon-16 x16-arrow-right" title="'._('Next').'"></span>';
28 <div
class="pagination_container">
30 $paging_step = config
::get('pagination.paging_step', '*'); # step used below to print nr of items per page
31 $max_items_per_page = config
::get('pagination.max_items_per_page', '*'); # maximum items per page to show
32 $entries = _('entries');
33 if (!isset($items_per_page)) {
34 $items_per_page = config
::get('pagination.items_per_page', '*');
37 $other_get_params = $_GET;
38 unset( $other_get_params['page'] );
39 unset( $other_get_params['items_per_page'] );
40 unset( $other_get_params['custom_pagination_field'] );
41 unset( $other_get_params['show_pagination'] );
44 <span
class="pagination_entries_str" style
="display:none"><?php
echo $entries ?
></span
>
46 <div
class="pagination_form">
47 <form action
="<?php echo basename($_SERVER['PHP_SELF']) ?>" method
="get">
49 <?php
foreach( $other_get_params as $key => $val ) { ?
>
50 <input type
="hidden" name
="<?php echo htmlentities($key); ?>" value
="<?php echo htmlentities($val) ?>" />
52 <select
class="auto" id
="sel_items_<?php echo $_SESSION['_pagination_id_'] ?>" class="items_per_page" name
="items_per_page" onchange
="preserve_get_params('sel', $(this).attr('id'));this.form.submit()">
54 if ($total_items < $paging_step) {
56 <option value
="<?php echo $total_items ?>" selected
="selected"><?php
echo $total_items ?
> <?php
echo $entries ?
></option
>
60 <option value
="<?php echo $total_items ?>"<?php
if ($items_per_page == $total_items) { ?
> selected
='selected'<?php
} ?
>><?php
echo _('All').' '.$entries ?
></option
>
63 if( $items_per_page < $paging_step ) {
64 ?
><option value
="<?php echo $items_per_page; ?>" selected
='selected'><?php
echo $items_per_page; ?
> <?php
echo $entries ?
></option
><?php
66 for ($i=$paging_step ; $i<$total_items && $i<=$max_items_per_page; $i+
=$paging_step ) {
67 ?
><option value
="<?php echo $i ?>"<?php
if ($items_per_page == $i) { ?
> selected
='selected'<?php
} ?
>><?php
echo $i ?
> <?php
echo $entries ?
></option
><?php
68 if( $items_per_page > $i && $items_per_page < ($i+
$paging_step) ) {
69 ?
><option value
="<?php echo $items_per_page; ?>" selected
='selected'><?php
echo $items_per_page; ?
> <?php
echo $entries ?
></option
><?php
76 type
="text" size
="4" name
="custom_pagination_field" id
="pagination_id_<?php echo $_SESSION['_pagination_id_'] ?>" class="custom_pagination_field"
77 title
="<?php echo _('Enter number of items to show on each page or select from the drop-down on the left') ?>"
78 value
="<?php echo $total_items < $items_per_page ? $total_items : $items_per_page ?>" />
79 <input type
="submit" name
="show_pagination" class="show_pagination" value
="<?php echo _('Go') ?>" />
84 <div
class="pagination">
85 <?php
$url = str_replace('&','&',$url); ?
>
86 <?php
if ($previous_page): ?
>
87 <a href
="<?php echo str_replace('{page}', $previous_page, $url) ?>" class="img prevpage"><?php
echo $label_previous ?
></a
>
89 <?php
echo $label_previous ?
>
93 <?php
if ($total_pages < 13): /* « Previous 1 2 3 4 5 6 7 8 9 10 11 12 Next » */ ?
>
95 <?php
for ($i = 1; $i <= $total_pages; $i++
): ?
>
96 <?php
if ($i == $current_page): ?
>
97 <strong
><?php
echo $i ?
></strong
>
99 <a href
="<?php echo str_replace('{page}', $i, $url) ?>"><?php
echo $i ?
></a
>
103 <?php
elseif ($current_page < 9): /* « Previous 1 2 3 4 5 6 7 8 9 10 … 25 26 Next » */ ?
>
105 <?php
for ($i = 1; $i <= 10; $i++
): ?
>
106 <?php
if ($i == $current_page): ?
>
107 <strong
><?php
echo $i ?
></strong
>
109 <a href
="<?php echo str_replace('{page}', $i, $url) ?>"><?php
echo $i ?
></a
>
114 <a href
="<?php echo str_replace('{page}', $total_pages - 1, $url) ?>"><?php
echo $total_pages - 1 ?
></a
>
115 <a href
="<?php echo str_replace('{page}', $total_pages, $url) ?>"><?php
echo $total_pages ?
></a
>
117 <?php
elseif ($current_page > $total_pages - 8): /* « Previous 1 2 … 17 18 19 20 21 22 23 24 25 26 Next » */ ?
>
119 <a href
="<?php echo str_replace('{page}', 1, $url) ?>">1</a
>
120 <a href
="<?php echo str_replace('{page}', 2, $url) ?>">2</a
>
123 <?php
for ($i = $total_pages - 9; $i <= $total_pages; $i++
): ?
>
124 <?php
if ($i == $current_page): ?
>
125 <strong
><?php
echo $i ?
></strong
>
127 <a href
="<?php echo str_replace('{page}', $i, $url) ?>"><?php
echo $i ?
></a
>
131 <?php
else: /* « Previous 1 2 … 5 6 7 8 9 10 11 12 13 14 … 25 26 Next » */ ?
>
133 <a href
="<?php echo str_replace('{page}', 1, $url) ?>">1</a
>
134 <a href
="<?php echo str_replace('{page}', 2, $url) ?>">2</a
>
137 <?php
for ($i = $current_page - 5; $i <= $current_page +
5; $i++
): ?
>
138 <?php
if ($i == $current_page): ?
>
139 <strong
><?php
echo $i ?
></strong
>
141 <a href
="<?php echo str_replace('{page}', $i, $url) ?>"><?php
echo $i ?
></a
>
146 <a href
="<?php echo str_replace('{page}', $total_pages - 1, $url) ?>"><?php
echo $total_pages - 1 ?
></a
>
147 <a href
="<?php echo str_replace('{page}', $total_pages, $url) ?>"><?php
echo $total_pages ?
></a
>
152 <?php
if ($next_page): ?
>
153 <a href
="<?php echo str_replace('{page}', $next_page, $url) ?>" class="img nextpage"><?php
echo $label_next ?
></a
>
155 <?php
echo $label_next ?
>
157 <?php
//echo ' (' . _('total') . ': ' . $total_items . ' ' . _('entries') . ')' ?>