Re: Pager and Cookies

From: Date: Wed, 26 Jan 2005 23:12:54 +0000
Subject: Re: Pager and Cookies
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-17194@lists.php.net to get a copy of this message
Hi, Andrew Nagy wrote:
I am implementing cookies with my paged application so that I can come back to the list without loosing my place. Basically the page number is stored in the cookie. However I am experiencing some strange results. My application is working fine as I page through the results, however the list of pages is showing that I am on the previous page (obviously because I have a cookie with the same name as the page variable). Is their a way that I can specify the page I am on instead of pager determining this for me with the $_REQUEST variable, or can the pager code be modified as to not use the $_REQUEST variable but to use the following if statement? if (isset($_POST[$pageId])) {
    ...
} elseif (isset($_GET[$pageId])) {
    ...
} elseif (isset($_COOKIE[$pageId])) {
    ...
}
if you have the latest release, you can set the current page number with the 'currentPage' option: $options = array(
    'mode'        => 'Sliding',
    'perPage'     => 3,
    'delta'       => 2,
    'itemData'    => array('a','b','c','d','e',),
    'currentPage' => $_COOKIE[$pageId],
); $pager =& Pager::factory($options); HTH -- Lorenzo Alberton http://pear.php.net/user/quipo

« previous php.pear.general (#17194) next »