Re: newbie in datagrid
| From: | brian | Date: | Fri, 10 Nov 2006 21:46:54 +0000 |
| Subject: | Re: newbie in datagrid | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25764@lists.php.net to get a copy of this message | ||
Lorenzo Alberton wrote:
brian wrote:GAH! Correct you are. I knew that, but had completely forgotten that bit. I was remembering my confusion but not the explanation. Sorry. I discovered that when i first installed it, but never got around to customising the wrapper because it did what was required as is. Thanks for the links. brianTry 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,