| Newsgroups |
php.pear.qa |
| Message-ID |
<[email protected]> |
iPhone
On Mar 5, 2012, at 2:37 AM, "[email protected]" <[email protected]> wrote:
> Edit report at https://pear.php.net/bugs/bug.php?id=18983&edit=1
>
> ID: 18983
> Comment by: [email protected]
> Reported By: michael at stellarent dot com
> Summary: Enhanced link formatting with <li> tags
> Status: Open
> Type: Feature/Change Request
> Package: Pager
> Operating System: Fedora 14 x64
> Package Version: 2.4.8
> PHP Version: 5.3.8
> Roadmap Versions:
> New Comment:
>
> After figuring out pear/Pager was on github, I decided to add a few
> options myself that would allow pagination in unordered list. I started
> out with the code from mpgjunky's patch, so thanks for that! The pull
> request can be found here: https://github.com/pear/Pager/pulls
>
>
> Previous Comments:
> ------------------------------------------------------------------------
>
> [2012-02-25 14:48:15] daftmav
>
> I completely agree with this request. The 'span' stuff should imo be
> deprecated, and an option to set your own wrapping html elements should
> be added.
>
> Kinda like how doctrine has it apparently, unfortunately I can't just
> switch to it. Would be great if Pager also got this kind of
> functionality, so we can wrap pagination in lists:
>
> // set page link display template
> $layout->setTemplate('<li><a href="{%url}">{%page}</a></li>');
>
> ------------------------------------------------------------------------
>
> [2011-11-11 22:03:31] mpgjunky
>
> Added #patch
> bug:18983;patch:pager-add-link-container;revision:1321049011;.
>
> ------------------------------------------------------------------------
>
> [2011-11-11 21:56:03] mpgjunky
>
> Description:
> ------------
> Hi,
>
> I needed to display the paging links from Structures_Datagrid,
> using the Smarty renderer - to be
> used in an un-ordered list (<ul>) tag.
>
> Therefore I needed each link wrapped inside an <li> tag, but I
> could not find a proper, simple
> method of achieving this. Perhaps I am wrong on this, and
> please forgive me if I am, but studying
> the code I noticed that the <a> tags has no pre/post options.
>
> Therefore, I propose a little change with the introduction of an
> option:
>
> var $_linkContainer = "li";
>
> and used like:
>
> return sprintf('%s<a href="%s"%s%s%s%s
> title="%s">%s</a>%s',
> empty($this->_linkContainer) ? '' :
> '<'.$this->_linkContainer.'>',
> htmlentities($this->_url . $href,
> ENT_COMPAT, 'UTF-8'),
> empty($this->_classString) ? '' : ' '.$this-
>> _classString,
> empty($this->_attributes) ? '' : ' '.$this-
>> _attributes,
> empty($this->_accesskey) ? '' : '
> accesskey="'.$this->_linkData[$this-
>> _urlVar].'"',
> empty($onclick) ? '' : '
> onclick="'.$onclick.'"',
> $altText,
> $linkText,
> empty($this->_linkContainer) ? '' :
> '</'.$this->_linkContainer.'>'
> );
>
> Furthermore, I would go as far as saying that the placing the
> 'current page class' in a <span> tag
> is a little too rigid, and the code does not allow for a flexible
> approach like having in the <a> tag
> instead. The net result I was look for was something like:
>
> <ul>
> <li><a>1</a></li>
> <li><a class="current">2</a></li>
> </ul>
>
> Alternatively, instead of using {getPaging} to output the links,
> why not have a {getLinks} smarty
> registered function, like in Pager->getLinks()? That way one
> could output them as one pleases.
>
> If I am wrong in any, please ignore this feature request and
> accept my apologies. If there's a way
> of achieving the desired result that I may have missed, I
> would love to hear about it, and once
> again please accept my apologies.
>
> Thanks,
> Michael.
>
> Test script:
> ---------------
> {getPaging prevImg="< Prev" nextImg="Next >" separator=""
> altPrev="Previous" }
>
> ...in any smarty template
>
>
> Expected result:
> ----------------
> <ul>
> <li><a>1</a></li>
> <li><a class="current">2</a></li>
> </ul>
>
>
> Actual result:
> --------------
> <b>1</b> | <a href="blah">2</a>
>
> the standard pager output.
>
> ------------------------------------------------------------------------
>
>
> --
> Edit this bug report at https://pear.php.net/bugs/bug.php?id=18983&edit=1
>
>
> --
> PEAR Bugs Mailing List (http://pear.php.net/bugs/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>