Re: New classes
| From: | Stig S. Bakken | Date: | Sat, 02 Feb 2002 01:35:45 +0000 |
| Subject: | Re: New classes | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-4372@lists.php.net to get a copy of this message | ||
On Sat, 2002-02-02 at 00:33, Richard Heyes wrote:
> Having spent the week mostly coding in preference to watching terrestrial TV
> in a hotel, I've come up with some new code that may be interesting.
>
> *** All should be considered "work in progress" ***
>
> HTTP_URL (http://phpguru.org/pear/HTTP_URL.phps)
>
> This class is intended to handle urls. Give it a url in the constructor and
> it will split it up into it's constituent parts for easy access. Stig
> mentioned on irc that it might be better named as URL, and also advised
> looking up this java class which looks interesting:
>
> http://hpdrc.cs.fiu.edu/sdbtools/VisualCafe/Documentation/Java/java.net.URL.
> html
>
> HTTP_Request (http://phpguru.org/pear/HTTP_Request.phps)
>
> This class handles making a http request via get or post, and returning the
> results. I envisioned it to sit underneath HTTP_POST in the great tree
> structured scheme of things. It also makes use of HTTP_URL. This one is far
> from finished. This could also make use of cURL if it's available to speed
> things up and make http request nice and portable.
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.
> Pager_Array (http://phpguru.org/pear/Pager_Array.phps)
>
> Inspired by Tomas' DB_Pager class when I found it was specific to SQL
> (doh!). Give it an indexed array of "stuff" and it will page it for you.
> Contains a couple of handy functions to return the next/back/page number
> links. No idea where this could sit - I'm doubtful a Pager category is
> warranted.
Good stuff. This is what I would want from a pager:
* getting the previous/next page
* setting page size
* getting a page index: at what offsets do pages 2 to 8 start?
* how many pages are there?
* on which page does offset N occur?
* which page is the last in the set?
* is the last page complete?
Just to prevent you from watching too much of that, ahem, terrestial TV
:-)
- Stig