RE: [PEAR] RE: DataObjects with Paged
| From: | ThE PhP_KiD | Date: | Mon, 28 Apr 2003 18:58:07 +0000 |
| Subject: | RE: [PEAR] RE: DataObjects with Paged | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-5106@lists.php.net to get a copy of this message | ||
Thank you, Deminan.
I will found a solution in order to mix:
- DB objects
- DB Pager
- Smarty
Regards
--
...ThE PhP_KiD.
-> -----Mensaje original-----
-> De: Demian Turner [mailto:demian@muse23.com]
-> Enviado el: Sábado, 26 de Abril de 2003 09:38 a.m.
-> Para: pear-general@lists.php.net
-> Asunto: Re: [PEAR] RE: DataObjects with Paged
->
->
-> I use the following code that works well for most situations:
->
-> $limit = PSG_RES_PER_PAGE;
-> require_once PSG_ENT_DIR . '/Property.php';
-> $output->template = 'wsProperty.html';
-> $propertyList = & new DataObjects_Property;
-> $propertyList->owner_id = Session::get('SESSION_UID');
-> $totalNumRows = $propertyList->count();
-> $propertyList->limit($input->from, $limit);
-> $result = $propertyList->find();
-> if($result > 0) {
-> $property = array();
-> while ($propertyList->fetch()) {
-> $propertyList->getLinks();
-> $property[] = $propertyList->__clone();
-> }
-> $data = DB_Pager::getData($input->from, $limit,
-> $totalNumRows, $maxpages);
-> // don't show pager if less than a pagefull
-> if($totalNumRows <= $limit)
-> $output->pager = false;
-> else
-> $output->pager = (object)$data;
-> }
-> $output->propertyList = $property;
->
-> The $output->pager property is set to false if there are fewer
-> results than your
-> paging limit, otherwise it holds the Pager object. Using Flexy
-> template, or any
-> template system for that matter, you can dynamically include a
-> 'pager.html'
-> template if you have say more than 10 results, 10 being your res
-> per page.
->
-> cheers
->
-> Demian
->
->
->
-> The Php_kid wrote:
-> > Sorry, I forgot to clear that I'm looking for
-> > a example of DataObject with PEAR::DB_Pager
-> > package.
-> >
-> > Thanks again.
-> > Mac
-> >
-> > ->
-> > -> Hi Alan,
-> > ->
-> > -> I've saw your example, but it is a bit complex to me.
-> > -> Have you a more simpler example about how to use
-> > -> DataObjects with Paged ?
-> > ->
-> > -> Thank you very much !
-> > ->
-> > -> Mac
-> > -> ...The PhP_KiD
-> > ->
-> > ->
-> > -> -> -----Mensaje original-----
-> > -> -> De: Alan Knowles [mailto:alan@akbkhome.com]
-> > -> -> Enviado el: Jueves, 24 de Abril de 2003 22:04
-> > -> -> Para: The Php_kid
-> > -> -> CC: pear-general@lists.php.net
-> > -> -> Asunto: Re: DataObjects with Paged
-> > -> ->
-> > -> ->
-> > -> -> this has an example using Pager_Sliding
-> > -> ->
-> > -> -> http://www.akbkhome.com:81/svn/akpear/HTML_FlexyFramework/FlexyFr
-> > -> -> amework/DatabaseBrowse.php
-> > -> ->
-> > -> ->
-> > -> -> Regards
-> > -> -> Alan
-> > -> ->
-> > -> -> The Php_kid wrote:
-> > -> -> > Hi DataObject users !!!
-> > -> -> >
-> > -> -> > How can I do to use DataObject in order
-> > -> -> > to get Paged results ?
-> > -> -> >
-> > -> -> > Have you an example ?
-> > -> -> >
-> > -> -> > Thank you !
-> > -> -> >
-> > -> -> >
-> > -> -> > Mac
-> > -> -> > ...The PhP_KiD
-> > -> ->
->
->
-> --
-> PEAR General Mailing List (http://pear.php.net/)
-> To unsubscribe, visit: http://www.php.net/unsub.php