Вход
Регистрация
PHP коды
| Пагинация
page = intval($_GET['page']); // if ($this->page < 1) $this->page = 1; $this->pages= ceil($items_count/$items_per_page); // if ($_GET['page'] == 'end' || $this->page > $this->pages) $this->page = $this->pages; $this->_at = $this->page * $items_per_page - $items_per_page; } /** * Отображение */ public function display($ref = '') { // Первая страница if ($this->page == 1) $output .= '1'; if ($this->page != 1) $output .= '
1
'; // Наш паравозик со страницами for ($i = -3; $i <= 3; $i++) { if (($this->page + $i) > 1 && ($this->page + $i) < $this->pages) { // if ($i == -3 && ($this->page + $i) > 2) $output .= '..'; // if (($this->page + $i) > 0) $output .= (($this->page + $i) == $this->page) ? $this->page : '
' . ($this->page + $i) . '
'; // if ($i == 3 && ($this->page + $i) < ($this->pages - 1)) $output .= '..'; } } // Последняя страница if ($this->page != $this->pages) $output .= '
' . $this->pages . '
'; if ($this->page == $this->pages) $output .= $this->pages; echo $output; } }
Онлайн: 2
Реклама
Наш надёжный хостинг партнёр
Купить рекламу