Файл: core/autoload/Pagenations.func.php
Строк: 10
<?
function page($url, $page, $posts, $num = 10)
{
$total = ceil($posts / $num);
$page = ($page <= 0 OR $page > $total) ? 1 : intval($page);
$start = $page * $num - $num;
$url = output($url);
$display = ($page != 1) ? '<a class="pager_a" href="'. $url .'1">«</a>' : NULL;
$display .= (($page - 2) > 0) ? '<a class="pager_a" href="'.$url.($page - 2).'">'.($page - 2).'</a>' : NULL;
$display .= (($page - 1) > 0) ? '<a class="pager_a" href="'.$url.($page - 1).'">'.($page - 1).'</a>' : NULL;
$display .= '<a class="pager_s" href="'.$url.$page.'">'.$page.'</a>';
$display .= (($page + 1) <= $total) ? '<a class="pager_a" href="'.$url.($page + 1 ).'">'. ($page + 1).'</a>' : NULL;
$display .= (($page + 2) <= $total) ? '<a class="pager_a" href="'.$url.($page + 2).'">'.($page + 2).'</a>' : NULL;
$display .= ($page != $total) ? '<a class="pager_a" href="'.$url.$total.'">»</a>' : NULL;
return compact('start', 'num', 'display');
}