Re: newbie in datagrid
| From: | Lorenzo Alberton | Date: | Fri, 10 Nov 2006 21:39:33 +0000 |
| Subject: | Re: newbie in datagrid | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25763@lists.php.net to get a copy of this message | ||
brian wrote:
Try Pear::Pager [snip] $pager = Pager_Wrapper_MDB2($db, $sql, $pagerOptions); Note that, for some reason, Pager's variables are array values. These really should be accessed through class methods, IMHO. For instance, the docs say there's a getLinks method but it doesn't appear to be present. I never got around to investigating that.just to clarify: Pager is a class, and as such all its variables can be accessed through class methods. Pager_Wrapper_MDB2(), otoh, is a function wrapping the functionality of Pager + MDB2. The one included in the /examples/ dir, is there (and not under /pear/Pager/) for a reason: it's a *sample* implementation of a Pager wrapper, which incidentally is general enough to suit most needs. You're free to (and supposed to) modify it as per your own needs. Do you want an object back? Do you want other methods like getLinks? Returning a customized return object should be trivial, once you see the code. FWIW, the bundled Pager_Wrapper returns an array since it's usually easier to pass it to a template engine. You may also find these tutorials interesting: http://www.alberton.info/pear_pager_tutorials.html http://www.alberton.info/pear_pager_tutorial_database_results.html HTH Best regards, -- Lorenzo Alberton http://pear.php.net/user/quipo ___________________________________________________________________ Quipo Free Internet - 2 email, 150 Mb di spazio web e molto di più. ADSL, Hardware & Software Online Store