Re: Pager: problem with getCurrentPageID()
| From: | Lorenzo Alberton | Date: | Sun, 04 Jan 2004 02:28:54 +0000 |
| Subject: | Re: Pager: problem with getCurrentPageID() | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9947@lists.php.net to get a copy of this message | ||
Hi
On Sat, 3 Jan 2004 21:17:41 -0000, Simon H wrote:
> I use $this->pageID rather than passing $_GET['pageID'] but the
> Pager class seems to rely on the GET var to produce the right
> results in getLinks(), getCurrentPageID(), etc. In getLinks I can
> $this->pager->getLinks($this->pageID) which fixes the links but
> current, next and previous don't work.
>
> Would it be possible to allow the passing of the $pageID in the
> Pager_Sliding contructor as an option - 'currentPage' (not sure
> that when setOption is called, it would overwrite $this-
> >_currentPage but might be a way to do it if it does?)?
>
> Any further suggestions to fix this?
uhm... the idea is nice, and the solution easy to implement.
I'll consider if adding such an option in the official package,
in the meanwhile you can fix your own copy doing the following
changes:
open Pager/Common.php, and add a 'currentPage' option to
the $allowed_options array in function _setOption().
Then add the following lines just before the ending brace of the
same method:
if (isset($options['currentPage'])) {
$this->_currentPage = $options['currentPage'];
}
That should do the trick :-)
Best regards,
Lorenzo