Новости Joomla

0 Пользователей и 1 Гость просматривают эту тему.
  • 4 Ответов
  • 1016 Просмотров
*

Chukotka

  • Новичок
  • 5
  • 0 / 0
Здравствуйте.
Подскажите, что мне нужно сделать, в коде ниже, что бы навигация внизу постоянно показывала кнопку Первая и Предыдущая

фаел  pagination.php

Код
<?php
/**
* @package   ZOO
* @author    YOOtheme http://www.yootheme.com
* @copyright Copyright (C) YOOtheme GmbH
* @license   http://www.gnu.org/licenses/gpl.html GNU/GPL
*/

/*
Class: AppPagination
The AppPagination Class. Provides Pagination functionality.
*/
class AppPagination {

public $app;

protected $_name;
protected $_total;
protected $_current;
protected $_limit;
protected $_range;
protected $_pages;
protected $_showall = false;

/*
     Function: constructor

Parameters:
     $name - Name of the pager http get var.
     $total - Total item count.
     $current - Current page.
     $limit - Item limit per page.
     $range - Range for displayed pagination pages.

  Returns:
     Void
  */
public function __construct($name, $total, $current = 1, $limit = 10, $range = 5) {

// init vars
$this->_name    = $name;
$this->_total   = (int) max($total, 0);
$this->_current = (int) max($current, 1);
$this->_limit   = (int) max($limit, 1);
        $this->_range   = (int) max($range, 1);
$this->_pages   = (int) ceil($this->_total / $this->_limit);
}

/*
     Function: getShowAll
  Get show all items parameter.

  Returns:
     Boolean
  */
public function getShowAll() {
return $this->_showall;
}

/*
     Function: setShowAll
  Set show all items parameter.

Parameters:
     $showall - Show all parameter.

  Returns:
     Void
  */
public function setShowAll($showall) {
$this->_showall = $showall;
}

/*
     Function: limitStart
  Get limit current limit start.

  Returns:
     Int
  */
public function limitStart() {
return ($this->_current - 1) * $this->_limit;
}

/*
     Function: link
  Get link with added get parameter.

  Returns:
String - Link url
  */
public function link($url, $vars) {

if (!is_array($vars)) {
$vars = array($vars);
}

return $url.(strpos($url, '?') === false ? '?' : '&').implode('&', $vars);
}

/*
     Function: render
  Render the paginator.

  Returns:
String - Pagination html
  */
    public function render($url = 'index.php') {

$html = '';

// check if show all
if ($this->_showall) {
return $html;
}

// check if current page is valid
        if ($this->_current > $this->_pages) {
            $this->_current = $this->_pages;
}

if ($this->_pages > 1) {

$range_start = max($this->_current - $this->_range, 1);
$range_end   = min($this->_current + $this->_range - 1, $this->_pages);

            if ($this->_current > 1) {
$link  = $url;
                $html .= '<a class="start" href="'.JRoute::_($link).'">Первая</a>&nbsp;';
$link  = $this->_current - 1 == 1 ? $url : $this->link($url, $this->_name.'='.($this->_current - 1));
$html .= '<a class="previous" href="'.JRoute::_($link).'">Предыдущая</a>&nbsp;';
            }

            for ($i = $range_start; $i <= $range_end; $i++) {
                if ($i == $this->_current) {
               $html .= '<span style="border-style:1px solid #999999;border-radius: 5px 5px 5px 5px;padding: 2px 10px;display: inline-block;color: #FFFFFF;background:#B6B6B6;text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);">'.$i.'</span>';
                } else {
$link  = $i == 1 ? $url : $this->link($url, $this->_name.'='.$i);
               $html .= '<a href="'.JRoute::_($link).'">'.$i.'</a>';
                }
                $html .= "&nbsp;";
            }

            if ($this->_current < $this->_pages) {
$link  = $this->link($url, $this->_name.'='.($this->_current + 1));
                $html .= '<a class="next" href="'.JRoute::_($link).'">Следующая</a>&nbsp;';
$link  = $this->link($url, $this->_name.'='.($this->_pages));
                $html .= '<a class="end" href="'.JRoute::_($link).'">Последняя</a>&nbsp;';
            }

}

        return $html;
    }

}
« Последнее редактирование: 19.03.2012, 21:19:48 от Chukotka »
*

Chukotka

  • Новичок
  • 5
  • 0 / 0
Re: Навигация в Адресной книге
« Ответ #1 : 19.03.2012, 20:01:52 »
Подскажите, что мне нужно сделать
*

Chukotka

  • Новичок
  • 5
  • 0 / 0
Re: Навигация в Адресной книге
« Ответ #2 : 19.03.2012, 20:23:24 »
Значит никто не знает или я неправильно сформулировал свой вопрос?
*

Chukotka

  • Новичок
  • 5
  • 0 / 0
Re: Навигация в Адресной книге
« Ответ #3 : 19.03.2012, 20:50:20 »
Было



а нужно

*

Chukotka

  • Новичок
  • 5
  • 0 / 0
Re: Навигация в Адресной книге
« Ответ #4 : 20.03.2012, 16:29:59 »
Ау кто нибудь, ПОМОГИТЕ.
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Навигация в галерее ZOO

Автор zloytapok

Ответов: 0
Просмотров: 883
Последний ответ 13.08.2012, 13:21:02
от zloytapok
Управление адресной строкой + зависимые поля + поля из БД. КАК?

Автор ImNIK

Ответов: 0
Просмотров: 1248
Последний ответ 02.03.2012, 15:08:34
от ImNIK