Новости Joomla

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

pavel2950

  • Захожу иногда
  • 194
  • 3 / 0
День добр, кто сможет помочь привести к такому виду http://joxi.ru/4Akaz5xSMkWZPm ?
 код самой пагинации ниже, сейчас работает код в таком виде http://joxi.ru/nAyoYkjSXwORym
Код
<?php
/**
 * @package     Joomla.Site
 * @subpackage  Templates.protostar
 *
 * @copyright   Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * This is a file to add template specific chrome to pagination rendering.
 *
 * pagination_list_footer
 * Input variable $list is an array with offsets:
 * $list[limit] : int
 * $list[limitstart] : int
 * $list[total] : int
 * $list[limitfield] : string
 * $list[pagescounter] : string
 * $list[pageslinks] : string
 *
 * pagination_list_render
 * Input variable $list is an array with offsets:
 * $list[all]
 * [data] : string
 * [active] : boolean
 * $list[start]
 * [data] : string
 * [active] : boolean
 * $list[previous]
 * [data] : string
 * [active] : boolean
 * $list[next]
 * [data] : string
 * [active] : boolean
 * $list[end]
 * [data] : string
 * [active] : boolean
 * $list[pages]
 * [{PAGE}][data] : string
 * [{PAGE}][active] : boolean
 *
 * pagination_item_active
 * Input variable $item is an object with fields:
 * $item->base : integer
 * $item->link : string
 * $item->text : string
 *
 * pagination_item_inactive
 * Input variable $item is an object with fields:
 * $item->base : integer
 * $item->link : string
 * $item->text : string
 *
 * This gives template designers ultimate control over how pagination is rendered.
 *
 * NOTE: If you override pagination_item_active OR pagination_item_inactive you MUST override them both
 */

/**
 * Renders the pagination footer
 *
 * @param   array   $list  Array containing pagination footer
 *
 * @return  string         HTML markup for the full pagination footer
 *
 * @since   3.0
 */
function pagination_list_footer($list)
{
$html = "<div class=\"pagination\">\n";
$html .= $list['pageslinks'];
$html .= "\n<input type=\"hidden\" name=\"" . $list['prefix'] . "limitstart\" value=\"" . $list['limitstart'] . "\" />";
$html .= "\n</div>";

return $html;
}

/**
 * Renders the pagination list
 *
 * @param   array   $list  Array containing pagination information
 *
 * @return  string         HTML markup for the full pagination object
 *
 * @since   3.0
 */
function pagination_list_render($list)
{
// Calculate to display range of pages
$currentPage = 1;
$range = 1;
$step = 5;
foreach ($list['pages'] as $k => $page)
{
if (!$page['active'])
{
$currentPage = $k;
}
}
if ($currentPage >= $step)
{
if ($currentPage % $step == 0)
{
$range = ceil($currentPage / $step) + 1;
}
else
{
$range = ceil($currentPage / $step);
}
}

$html = '<ul class="uk-pagination">';
$html .= $list['start']['data'];
$html .= $list['previous']['data'];

foreach ($list['pages'] as $k => $page)
{
if (in_array($k, range($range * $step - ($step + 1), $range * $step)))
{
if (($k % $step == 0 || $k == $range * $step - ($step + 1)) && $k != $currentPage && $k != $range * $step - $step)
{
$page['data'] = preg_replace('#(<a.*?>).*?(</a>)#', '$1...$2', $page['data']);
}
}

$html .= $page['data'];
}

$html .= $list['next']['data'];
$html .= $list['end']['data'];

$html .= '</ul>';
return $html;
}

/**
 * Renders an active item in the pagination block
 *
 * @param   JPaginationObject  $item  The current pagination object
 *
 * @return  string                    HTML markup for active item
 *
 * @since   3.0
 */
function pagination_item_active(&$item)
{
$class = '';

// Check for "Start" item
if ($item->text == JText::_('JLIB_HTML_START'))
{
$display = '<i class="uk-icon-angle-left"></i>';
}

// Check for "Prev" item
if ($item->text == JText::_('JPREV'))
{
$display = '<i class="uk-icon-angle-double-left"></i>';
}

// Check for "Next" item
if ($item->text == JText::_('JNEXT'))
{
$display = '<i class="uk-icon-angle-double-right"></i>';
}

// Check for "End" item
if ($item->text == JText::_('JLIB_HTML_END'))
{
$display = '<i class="uk-icon-angle-right"></i>';
}

// If the display object isn't set already, just render the item with its text
if (!isset($display))
{
$display = $item->text;
$class   = '';
}

return '<li' . $class . '><a title="' . $item->text . '" href="' . $item->link . '" class="pagenav">' . $display . '</a></li>';
}

/**
 * Renders an inactive item in the pagination block
 *
 * @param   JPaginationObject  $item  The current pagination object
 *
 * @return  string  HTML markup for inactive item
 *
 * @since   3.0
 */
function pagination_item_inactive(&$item)
{
// Check for "Start" item
if ($item->text == JText::_('JLIB_HTML_START'))
{
return '<li class="uk-disabled"></li>';
}

// Check for "Prev" item
if ($item->text == JText::_('JPREV'))
{
return '<li class="uk-disabled"></li>';
}

// Check for "Next" item
if ($item->text == JText::_('JNEXT'))
{
return '<li class="uk-disabled"></li>';
}

// Check for "End" item
if ($item->text == JText::_('JLIB_HTML_END'))
{
return '<li class="uk-disabled"></li>';
}

// Check if the item is the active page
if (isset($item->active) && ($item->active))
{
return '<li class="uk-active"><a>' . $item->text . '</a></li>';
}

// Doesn't match any other condition, render a normal item
return '<li class="uk-disabled"><a>' . $item->text . '</a></li>';
}

Не могу разобраться как это все сделать.

« Последнее редактирование: 17.08.2017, 15:31:55 от pavel2950 »
*

pavel2950

  • Захожу иногда
  • 194
  • 3 / 0
Re: Изменить внешний вид пагинации
« Ответ #1 : 17.08.2017, 15:31:24 »
Решил задачу
Этот код надо

Код
 $html .=  '<li> Просмотренно страниц '.$currentPage.' из '.substr($k,-1).'</li>';

вставить в функцию function pagination_list_render($list)


ФУЛ КОД  чтоб получить результат http://joxi.ru/4Akaz5xSMkWZPm
Код
<?php
/**
 * @package     Joomla.Site
 * @subpackage  Templates.protostar
 *
 * @copyright   Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * This is a file to add template specific chrome to pagination rendering.
 *
 * pagination_list_footer
 * Input variable $list is an array with offsets:
 * $list[limit] : int
 * $list[limitstart] : int
 * $list[total] : int
 * $list[limitfield] : string
 * $list[pagescounter] : string
 * $list[pageslinks] : string
 *
 * pagination_list_render
 * Input variable $list is an array with offsets:
 * $list[all]
 * [data] : string
 * [active] : boolean
 * $list[start]
 * [data] : string
 * [active] : boolean
 * $list[previous]
 * [data] : string
 * [active] : boolean
 * $list[next]
 * [data] : string
 * [active] : boolean
 * $list[end]
 * [data] : string
 * [active] : boolean
 * $list[pages]
 * [{PAGE}][data] : string
 * [{PAGE}][active] : boolean
 *
 * pagination_item_active
 * Input variable $item is an object with fields:
 * $item->base : integer
 * $item->link : string
 * $item->text : string
 *
 * pagination_item_inactive
 * Input variable $item is an object with fields:
 * $item->base : integer
 * $item->link : string
 * $item->text : string
 *
 * This gives template designers ultimate control over how pagination is rendered.
 *
 * NOTE: If you override pagination_item_active OR pagination_item_inactive you MUST override them both
 */

/**
 * Renders the pagination footer
 *
 * @param   array   $list  Array containing pagination footer
 *
 * @return  string         HTML markup for the full pagination footer
 *
 * @since   3.0
 */
function pagination_list_footer($list)
{
   
   
$html = "<div class=\"pagination\">\n";
$html .= $list['pageslinks'];

$html .= "\n<input type=\"hidden\" name=\"" . $list['prefix'] . "limitstart\" value=\"" . $list['limitstart'] . "\" />";
$html .= "\n</div>";

return $html;
}

/**
 * Renders the pagination list
 *
 * @param   array   $list  Array containing pagination information
 *
 * @return  string         HTML markup for the full pagination object
 *
 * @since   3.0
 */
function pagination_list_render($list)
{
// Calculate to display range of pages
$currentPage = 1;
$range = 1;
$step = 5;
foreach ($list['pages'] as $k => $page)
{
//вот это еще условие добавил чтоб считать какой активный сейчас номер странице
                if (!$page['active'])
{
$currentPage = $k;
           
}
       
}
    /* if ($currentPage >= $step)
{
if ($currentPage % $step == 0)
{
$range = ceil($currentPage / $step) + 1;
}
else
{
$range = ceil($currentPage / $step);
}
}*/

$html = '<ul class="uk-pagination">';
// $html .= $list['start']['data'];  // закоментировал чтоб листать по 1 странице

$html .= $list['previous']['data'];

foreach ($list['pages'] as $k => $page)
{
       if (!$page['active'])
{
$currentPage = $k;
           
}
           
             
if (in_array($k, range($range * $step - ($step + 1), $range * $step)))
    {
    if (($k % $step == 0 || $k == $range * $step - ($step + 1)) && $k != $currentPage && $k != $range * $step - $step)
    {
    $page['data'] = preg_replace('#(<a.*?>).*?(</a>)#', '$1...$2', $page['data']);
                   
    }
    }
   
    }
   
    $html .=  '<li> Просмотренно страниц '.$currentPage.' из '.substr($k,-1).'</li>'; // вот эта штука и выводит в том виде в котором надо 
$html .= $list['next']['data'];
// $html .= $list['end']['data'];  // закоментировал чтоб листать по 1 странице

$html .= '</ul>';
return $html;
}

/**
 * Renders an active item in the pagination block
 *
 * @param   JPaginationObject  $item  The current pagination object
 *
 * @return  string                    HTML markup for active item
 *
 * @since   3.0
 */
function pagination_item_active(&$item)
{
$class = '';

// Check for "Start" item
if ($item->text == JText::_('JLIB_HTML_START'))
{
$display = '<i class="uk-icon-angle-double-left"></i>';
}

// Check for "Prev" item
if ($item->text == JText::_('JPREV'))
{
$display = '<i class="uk-icon-angle-left"></i>';
}

// Check for "Next" item
if ($item->text == JText::_('JNEXT'))
{
$display = '<i class="uk-icon-angle-right"></i>';
}

// Check for "End" item
if ($item->text == JText::_('JLIB_HTML_END'))
{
$display = '<i class="uk-icon-angle-double-right"></i>';
}

// If the display object isn't set already, just render the item with its text
if (!isset($display))
{
$display = $item->text;
$class   = '';
}

return '<li' . $class . '><a title="' . $item->text . '" href="' . $item->link . '" class="pagenav">' . $display . '</a></li>';
}

/**
 * Renders an inactive item in the pagination block
 *
 * @param   JPaginationObject  $item  The current pagination object
 *
 * @return  string  HTML markup for inactive item
 *
 * @since   3.0
 */
function pagination_item_inactive(&$item)
{
// Check for "Start" item
if ($item->text == JText::_('JLIB_HTML_START'))
{
return '<li class="uk-disabled"></li>';
}

// Check for "Prev" item
if ($item->text == JText::_('JPREV'))
{
return '<li class="uk-disabled"></li>';
}

// Check for "Next" item
if ($item->text == JText::_('JNEXT'))
{
return '<li class="uk-disabled"></li>';
}

// Check for "End" item
if ($item->text == JText::_('JLIB_HTML_END'))
{
return '<li class="uk-disabled"></li>';
}

// Check if the item is the active page
if (isset($item->active) && ($item->active))
{
return '<li class="uk-active"><a>' . $item->text . '</a></li>';
}

// Doesn't match any other condition, render a normal item
return '<li class="uk-disabled"><a>' . $item->text . '</a></li>';
}

Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Как убрать текст на главной?

Автор m03mug08

Ответов: 5
Просмотров: 1054
Последний ответ 07.09.2018, 14:52:24
от Konst
Проблема отображения модулей на шаблоне proto

Автор Artefact

Ответов: 10
Просмотров: 968
Последний ответ 17.08.2017, 18:29:40
от Artefact
Кто запускал image recycle кроном?

Автор pavelrer

Ответов: 23
Просмотров: 1676
Последний ответ 14.08.2017, 17:16:10
от dmitry_stas
Поддомены в папках основного домена

Автор Dmitriy5023

Ответов: 4
Просмотров: 1690
Последний ответ 08.08.2017, 01:40:49
от Филипп Сорокин
Как на одной странице разместить 16 видео?

Автор zahar_92

Ответов: 16
Просмотров: 1124
Последний ответ 14.07.2017, 09:30:28
от zahar_92