Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.
1 to 10 of 10
function generate_pagination($level, $id, $current_page, $items_total, $items_on_page, $args = array()) {
$output = '';
if (!isset($GLOBALS['total_pictures'])) $GLOBALS['total_pictures'] = 0;
if (($items_total == 0) && ($GLOBALS['total_pictures'] > 0)) {
$items_total = $GLOBALS['total_pictures'];
}
$num_pages = ceil($items_total / $items_on_page);
if ($num_pages > 1) {
if ($current_page > 1) {
if ($current_page != 2) {
$args[1] = 'page';
$args['plog_page'] = $current_page - 1;
}
$output .= '<a title="'.plog_tr('Previous').'" accesskey="," class="pagPrev" href="'.generate_url($level, $id, $args).'"><span>«</span></a>';
}
if ($num_pages > 6) {
if ($current_page - 3 > 0){
if ($current_page + 3 < $num_pages){
for ($i =$current_page - 3; $i <= $current_page + 3; $i++)
{
if ($i == $current_page) {
$output .= '<span class="page-link-current">'.$i.'</span>';
} else {
if ($i != 1) {
$args[1] = 'page';
$args['plog_page'] = $i;
} else {
unset($args[1]);
unset($args['plog_page']);
}
$output .= '<a href="'.generate_url($level, $id, $args).'" class="page-link">'.$i.'</a>';
}
}
}
else{
for ($i =$current_page - 3; $i <= $num_pages; $i++)
{
if ($i == $current_page) {
$output .= '<span class="page-link-current">'.$i.'</span>';
} else {
if ($i != 1) {
$args[1] = 'page';
$args['plog_page'] = $i;
} else {
unset($args[1]);
unset($args['plog_page']);
}
$output .= '<a href="'.generate_url($level, $id, $args).'" class="page-link">'.$i.'</a>';
}
}
}
}//if end
else{
if($current_page + 3 < $num_pages){
for ($i = 1; $i <= $current_page + 3; $i++)
{
if ($i == $current_page) {
$output .= '<span class="page-link-current">'.$i.'</span>';
} else {
if ($i != 1) {
$args[1] = 'page';
$args['plog_page'] = $i;
} else {
unset($args[1]);
unset($args['plog_page']);
}
$output .= '<a href="'.generate_url($level, $id, $args).'" class="page-link">'.$i.'</a>';
}
}
}//if end
else{
for ($i = 1; $i <= $num_pages; $i++)
{
if ($i == $current_page) {
$output .= '<span class="page-link-current">'.$i.'</span>';
} else {
if ($i != 1) {
$args[1] = 'page';
$args['plog_page'] = $i;
} else {
unset($args[1]);
unset($args['plog_page']);
}
$output .= '<a href="'.generate_url($level, $id, $args).'" class="page-link">'.$i.'</a>';
}
}
}
}//else end
}// num-pages end
else{
for ($i = 1; $i <= $num_pages; $i++)
{
if ($i == $current_page) {
$output .= '<span class="page-link-current">'.$i.'</span>';
} else {
if ($i != 1) {
$args[1] = 'page';
$args['plog_page'] = $i;
} else {
unset($args[1]);
unset($args['plog_page']);
}
$output .= '<a href="'.generate_url($level, $id, $args).'" class="page-link">'.$i.'</a>';
}
}
} // num-pages < 6
if ($current_page != $num_pages) {
$args[1] = 'page';
$args['plog_page'] = $current_page + 1;
$output .= '<a title="'.plog_tr('Next').'" accesskey="." class="pagNext" href="'.generate_url($level, $id, $args).'"><span>»</span></a>';
}
}
return $output;
}
1 to 10 of 10