Home » HTML » Pager » Bug #4496
New Feature to add first and last pages with diffs
Details
| Request #4496 | New Feature to add first and last pages with diffs |
|---|---|
| Submitted | 2005-06-01 03:24 UTC |
| From | danielr at electroteque dot org |
| Assigned | quipo |
| Status | Closed |
| Package | Pager |
| PHP Version | 5.0.3 |
| OS | N/A |
| Roadmaps | (Not assigned) |
Comments
[2005-06-01 03:24 UTC] danielr at electroteque dot org
Description:
------------
I have created diffs on some changes I find useful I
have added first and last page link methods, I have only
showed them in Jumping but could be transfered to
Sliding. New settings are allowed, lastImg , firstImg,
altLast and altFirst.
www.electroteque.org/pear/Common.diff
www.electroteque.org/pear/Jumping.diff
Please let me know if its possible or if the diff is not
correct.
[2005-06-01 10:47 UTC] danielr at electroteque dot org
Lets look at this for starters
/**
* Print [1]
*
* @return string String with link to 1st page,
* or empty string if this is the 1st
page.
* @access private
*/
function _printFirstPage()
{
if ($this->isFirstPage()) {
return '';
}
$this->_linkData[$this->_urlVar] = 1;
return $this->_renderLink(
$this->_altPage.' 1',
$this->_firstPagePre . $this-
>_firstPageText . $this->_firstPagePost
) . $this->_spacesBefore . $this->_spacesAfter;
}
Ok we have an option for make the option firstPageText
an image, however, you have a method for next and prev,
why not first and last, so i can use firstImg and
altFirst, which is customisable and standard for all of
them ? I dont see any alt text for the href either.
/**
* Returns back link
*
* @param $url URL to use in the link [deprecated:
use the factory instead]
* @param $link HTML to use as the link [deprecated:
use the factory instead]
* @return string The link
* @access private
*/
function _getBackLink($url='', $link='')
{
//legacy settings... the preferred way to set an
option
//now is passing it to the factory
if (!empty($url)) {
$this->_path = $url;
}
if (!empty($link)) {
$this->_prevImg = $link;
}
$back = '';
if ($this->_currentPage > 1) {
$this->_linkData[$this->_urlVar] = $this-
>getPreviousPageID();
$back = $this->_renderLink($this->_altPrev,
$this->_prevImg)
. $this->_spacesBefore . $this-
>_spacesAfter;
}
return $back;
}
I then execute the methods inside the structures
datagrid flexy renderer like so, much cleaner
function getPaging()
{
return $this->pager->links;
}
[2005-06-02 10:26 UTC] danielr at electroteque dot org
If I can simply do this somehow i'll be done with it, as
this is called from my flexy template, chunking arrays
is really silly
function getPaging()
{
return $this->pager->links;
}
[2005-06-02 10:30 UTC] danielr at electroteque dot org
btw you never explained why you have a nextImg and
prevImg setting and then its not standard to have a
lastImg and firstImg sounds pretty straight forward than
lastPageText and firstPageText doesnt it ? How
confusing. Oh well u are god.