| Newsgroups |
php.pear.qa |
| Message-ID |
<[email protected]> |
LING-PENG
=D4=DA 2012-11-24=A3=AC22:35=A3=ACPEARBug Database <[email protected]> =D0=
=B4=B5=C0=A3=BA
> ATTENTION! Do NOT reply to this email!
> To reply, use the web interface found at
> https://pear.php.net/bugs/bug.php?id=3D18983&edit=3D2
>=20
>=20
> ID: 18983
> Comment by: [email protected]
> Reported By: michael at stellarent dot com
> Summary: Enhanced link formatting with <li> tags
> Status: Assigned
> Type: Feature/Change Request
> Package: Pager
> Operating System: Fedora 14 x64
> Package Version: 2.4.8
> PHP Version: 5.3.8
> Assigned To: quipo
> Roadmap Versions:=20
> New Comment:
>=20
> Hi,
>=20
> Any chance of getting my patch merged to the official release?
>=20
> Cheers,
> Michael.
>=20
>=20
> Previous Comments:
> ------------------------------------------------------------------------
>=20
> [2012-03-19 07:03:52] doconnor
>=20
> -Status: Open
> +Status: Assigned
> -Assigned To:
> +Assigned To: quipo
>=20
>=20
> ------------------------------------------------------------------------
>=20
> [2012-03-04 18:37:07] daftmav
>=20
> 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
>=20
> ------------------------------------------------------------------------
>=20
> [2012-02-25 14:48:15] daftmav
>=20
> 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.
>=20
> 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:
>=20
> // set page link display template
> $layout->setTemplate('<li><a href=3D"{%url}">{%page}</a></li>');
>=20
> ------------------------------------------------------------------------
>=20
> [2011-11-11 22:03:31] mpgjunky
>=20
> Added #patch
> bug:18983;patch:pager-add-link-container;revision:1321049011;.
>=20
> ------------------------------------------------------------------------
>=20
> [2011-11-11 21:56:03] mpgjunky
>=20
> Description:
> ------------
> Hi,
>=20
> I needed to display the paging links from Structures_Datagrid,=20
> using the Smarty renderer - to be=20
> used in an un-ordered list (<ul>) tag.
>=20
> Therefore I needed each link wrapped inside an <li> tag, but I=20
> could not find a proper, simple=20
> method of achieving this. Perhaps I am wrong on this, and=20
> please forgive me if I am, but studying=20
> the code I noticed that the <a> tags has no pre/post options.
>=20
> Therefore, I propose a little change with the introduction of an=20
> option:
>=20
> var $_linkContainer =3D "li";
>=20
> and used like:
>=20
> return sprintf('%s<a href=3D"%s"%s%s%s%s=20
> title=3D"%s">%s</a>%s',
> empty($this->_linkContainer) ? '' :=20
> '<'.$this->_linkContainer.'>',
> htmlentities($this->_url . $href,=20
> ENT_COMPAT, 'UTF-8'),
> empty($this->_classString) ? '' : ' '.$this-
>> _classString,
> empty($this->_attributes) ? '' : ' '.$this-
>> _attributes,
> empty($this->_accesskey) ? '' : '=20
> accesskey=3D"'.$this->_linkData[$this-
>> _urlVar].'"',
> empty($onclick) ? '' : '=20
> onclick=3D"'.$onclick.'"',
> $altText,
> $linkText,
> empty($this->_linkContainer) ? '' :=20
> '</'.$this->_linkContainer.'>'
> );
>=20
> Furthermore, I would go as far as saying that the placing the=20
> 'current page class' in a <span> tag=20
> is a little too rigid, and the code does not allow for a flexible=20
> approach like having in the <a> tag=20
> instead. The net result I was look for was something like:
>=20
> <ul>
> <li><a>1</a></li>
> <li><a class=3D"current">2</a></li>
> </ul>
>=20
> Alternatively, instead of using {getPaging} to output the links,=20
> why not have a {getLinks} smarty=20
> registered function, like in Pager->getLinks()? That way one=20
> could output them as one pleases.
>=20
> If I am wrong in any, please ignore this feature request and=20
> accept my apologies. If there's a way=20
> of achieving the desired result that I may have missed, I=20
> would love to hear about it, and once=20
> again please accept my apologies.
>=20
> Thanks,
> Michael.
>=20
> Test script:
> ---------------
> {getPaging prevImg=3D"< Prev" nextImg=3D"Next >" separator=3D""
> altPrev=3D"Previous" }
>=20
> ...in any smarty template
>=20
>=20
> Expected result:
> ----------------
> <ul>
> <li><a>1</a></li>
> <li><a class=3D"current">2</a></li>
> </ul>
>=20
>=20
> Actual result:
> --------------
> <b>1</b> | <a href=3D"blah">2</a>
>=20
> the standard pager output.
>=20
> ------------------------------------------------------------------------
>=20
>=20