PDA

Zobacz pełną wersję : Paginacja, ikony jako linki



spooxmobile
19-01-2012, 00:48
Witam, Przygotowuje jedna strone i jej wlasciciel zamierza zrezygnowac z czesci paginacji (chce zostawic tylko poprzedni i nastepny ale jako ikonki - strzalki)

rozumiem, ze za generowanie odpowiada function _list_render w pagination.php, ktora to poprawiona wyglada tak:


protected function _list_render($list)
{
// Reverse output rendering for right-to-left display.
$html = '<ul>';
$html .= '<li class="pagination-prev">'.$list['previous']['data'].'</li>';
$html .= '<li class="pagination-next">'. $list['next']['data'].'</li>';
$html .= '</ul>';

return $html;
}


ale teraz mam problem. Nie wiem jak zastapic linki "prev" i "next" ikonkami. chcialbym, zeby zamiast slow byly wstawione obrazki, ktore bylyby linkami

rzucilby ktos okiem na to? doradzil? diabel gdzies tkwi w tym kawalku kodu:



protected function _list_footer($list)
{
$html = "<div class=\"list-footer\">\n";

$html .= "\n<div class=\"limit\">".JText::_('JGLOBAL_DISPLAY_NUM').$list['limitfield']."</div>";
$html .= $list['pageslinks'];
$html .= "\n<div class=\"counter\">".$list['pagescounter']."</div>";

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

return $html;
}

/*
* Create the html for a list footer
*
* @param array $list
*
* @return string HTML for a list start, previous, next,end
* @since 11.1
*/
protected function _list_render($list)
{
// Reverse output rendering for right-to-left display.
$html = '<ul>';

$html .= '<li class="pagination-prev">'.$list['previous']['data'].'</li>';

$html .= '<li class="pagination-next">'. $list['next']['data'].'</li>';

$html .= '</ul>';

return $html;
}

/*
*
*
* @param object $item
*
* @return string HTML link
* @since 11.1
*/
protected function _item_active(&$item)
{
$app = JFactory::getApplication();
if ($app->isAdmin())
{
if ($item->base > 0) {
return "<a title=\"".$item->text."\" onclick=\"document.adminForm." . $this->prefix . "limitstart.value=".$item->base."; Joomla.submitform();return false;\">".$item->text."</a>";
}
else {
return "<a title=\"".$item->text."\" onclick=\"document.adminForm." . $this->prefix . "limitstart.value=0; Joomla.submitform();return false;\">".$item->text."</a>";
}
}
else {
return "<a title=\"".$item->text."\" href=\"".$item->link."\" class=\"pagenav\">".$item->text."</a>";
}
}

/*
*
*
* @param object $item
*
* @return string
* @since 11.1
*/
protected function _item_inactive(&$item)
{
$app = JFactory::getApplication();
if ($app->isAdmin()) {
return "<span>".$item->text."</span>";
}
else {
return "<span class=\"pagenav\">".$item->text."</span>";
}
}


Z giry dziekuje za pomoc

spooxmobile

spooxmobile
29-01-2012, 01:20
Witam,

zrobilem rozwiazanie polowiczne, ktore mnie nie satysfakcjonuje. w css podstawilem obrazek i czcionke zrobilem w kolorze przezroczystym. Niestety nie jest to dobre rozwiazanie bo IE pokazuje czciaonke w innym kolorze niz przezroczystym. zobaczyc to mozna tu: dantepineda.com/arte

Znalazlem w necie rozwiaznie dla j1.5, ktore sprawdzilem na jednej instalacji i dziala dobrze. Probowalem zaimplementowac to rozwiaznie do j1.7 ale niestety cos dziala zle, ze nie dziala.
Czy ktosby mogl rzucic okiem - prosze.

w templatce zrobilem katalog "html" tam umiescilem plik pagination.php o nastepujacej tresci:


<?php
/**
* @version $Id: pagination.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// no direct access
defined('_JEXEC') or die('Restricted access');

/**
* 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
*/

function pagination_list_footer($list)
{
$html = "<div class=\"list-footer\">\n";

$html .= "\n<div class=\"limit\">".JText::_('JGLOBAL_DISPLAY_NUM').$list['limitfield']."</div>";
$html .= $list['pageslinks'];
$html .= "\n<div class=\"counter\">".$list['pagescounter']."</div>";

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

return $html;
}



function pagination_list_render($list)
{
// Reverse output rendering for right-to-left display.
$html = '<ul>';

$html .= '<li class="pagination-prev">'.$list['previous']['data'].'</li>';

$html .= '<li class="pagination-next">'. $list['next']['data'].'</li>';

$html .= '</ul>';

return $html;
}

function pagination_item_active(&$item)



{

switch ($item->text){


case JText::_('JPREV'):
$cadImg = "<img src='images/stories/navegacion/avanzar--29x29.jpg'";
break;
case JText::_('JNEXT'):
$cadImg = "<img src='images/stories/navegacion/avanzar--29x29.jpg'";
break;

default:
$cadImg = $item->text;
break;
}

$cad = "<li><strong><a href=\"".$item->link."\" >".$cadImg."</a></strong></li>";

return $cad;
}




function pagination_item_inactive(&$item) {
switch ($item->text){

case JText::_('JPREV'):
$cadImg = "<img src='images/stories/navegacion/avanzar--29x29.jpg'";
break;
case JText::_('JNEXT'):
$cadImg = "<img src='images/stories/navegacion/avanzar--29x29.jpg'";
break;
default:
$cadImg = $item->text;
break;
}

$cad = "<li>".$cadImg."</li>";

return $cad;
}


?>


niestety cos zrobilem zle i nie wychodzi, ktos moglby w to zajrzec.

dziekuje

Spooxmobile

nikszal
29-01-2012, 01:31
Coś spartoliłeś w Opcjch artykułow, bo powinieneś otrzymać ten rezultat (<< Poprzedni Następny>>) tylko w tym miejscu bez poprawiania plików.

Opisz swoją konfigurację Opcji artykułow.

coliberek1
29-01-2012, 17:33
zrobilem rozwiazanie polowiczne, ktore mnie nie satysfakcjonuje. w css podstawilem obrazek i czcionke zrobilem w kolorze przezroczystym. Niestety nie jest to dobre rozwiazanie bo IE pokazuje czciaonke w innym kolorze niz przezroczystym. zobaczyc to mozna tu: dantepineda.com/arte

A jakbyś w pliku językowym zamienił
JPREV="Prev" na JPREV="" a JNEXT="Next" na JNEXT=""

To zniknęłyby napisy i zostałby tylko sam obrazek.

spooxmobile
30-01-2012, 16:50
@nikszal - wlasnie, ze otrzemuje taki wynik (poprz nastepny) ale idea tego jest, zeby nie otrzymywac napiso, tylko obrazek jako link (strzalka)

nigdy nie udalo mi sie uruchomic tego przy zmianach w php. szczegolnie chodzi o ten kawalek kodu, wydaje mi sie, ze gdzes tu zrobilem blad i nie zastepuje linka tekstowego linkiem obrazkowym. Ktos by sie spojrzal?:

function pagination_item_active(&$item)



{

switch ($item->text){


case JText::_('JPREV'):
$cadImg = "<img src='images/stories/navegacion/avanzar--29x29.jpg'";
break;
case JText::_('JNEXT'):
$cadImg = "<img src='images/stories/navegacion/avanzar--29x29.jpg'";
break;

default:
$cadImg = $item->text;
break;
}

$cad = "<li><strong><a href=\"".$item->link."\" >".$cadImg."</a></strong></li>";

return $cad;
}

@coliberek1 nie zrobilem tak jak ty to przedstawiles. po prostu zmniejszylem czcionke do 1px i kolorystycznie wtopilem ja w obrazek strzalki. jednak wolalbym miec to rozwiazane w php.

pozdrawiuam

Spooxmobile