RE: [PEAR-DEV] New classes

From: Date: Sun, 03 Feb 2002 14:59:27 +0000
Subject: RE: [PEAR-DEV] New classes
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-4382@lists.php.net to get a copy of this message
> I don't think HTTP_POST should be a separate class, but rather a > customization of HTTP_Request. But if you make HTTP_Request you should > complement it with HTTP_Response. HTTP_Response could store headers and > maybe have a MIME content interface. How about having a structure like this: HTTP_Client | +-HTTP_Request | +-HTTP_Response > Good stuff. This is what I would want from a pager: Ok I've put latest version up at: http://phpguru.org/pear/Pager.phps > * getting the previous/next page There's a generic getPageData() function which takes an optional pageID, defaulting to current. Given that the links are passed via querystring pageID parameter, you could do this: $obj->getPageData($_GET['pageID'] + 1) I could also define some handy consts, PAGER_NEXT, PAGER_CURRENT, PAGER_PREVIOUS. > * setting page size Do this in the parameters supplied to constructor. Defaults to 10. > * getting a page index: at what offsets do pages 2 to 8 start? Todo. > * how many pages are there? $obj->numPages(); > * on which page does offset N occur? $obj->getPageIdByOffset(14); // Gets pageID containing 14th item > * which page is the last in the set? $obj->numPages(); > * is the last page complete? $obj->isLastPageComplete(); There's also isLastPage() and isFirstPage() which return true/false based on current pageID. > Just to prevent you from watching too much of that, ahem, terrestial TV > :-) You have my thanks. :) -- Richard Heyes "If you have any trouble sounding condescending, find a Unix user to show you how it's done." - Scott Adams

« previous php.pear.dev (#4382) next »