Re: HTML_Template_Flexy and DB_DataObject with Paging (and lack of flexy:while)

From: Date: Wed, 13 Apr 2005 13:13:42 +0000
Subject: Re: HTML_Template_Flexy and DB_DataObject with Paging (and lack of flexy:while)
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-18725@lists.php.net to get a copy of this message
Ok here u go, I have built a custom renderer for structures datagrid. The dg already hooks into Pager, I have some custom paging methods to use image navigation rather than text. Here is the link http://www.electroteque.org/pear/Flexy_DO_DG/ the below function i send the do, the listing template, which is available at the url, the limit clause function data_grid($do, $template, $limit = 15, $obj = null) { require_once 'Structures/DataGrid.php'; require_once 'Structures/DataGrid/DataSource.php'; $dg =& new Structures_DataGrid($_GET['setPerPage'] ? $_GET['setPerPage'] : $limit,$_GET['page'] ? $_GET['page'] : 1,'Flexy'); $data = Structures_DataGrid_DataSource::create($do,false,'MDB2'); $dg->bindDataSource($data); $this->dg = $dg; $dg->renderer->setTemplate($template); return $dg->renderer->render($obj); } the function in action function action_default() { $progress = DB_DataObject::factory('complaints'); if ($this->auth->is_masteradmin()) { $progress->getInProgress(); } elseif ($this->auth->is_admin()) { $progress->getDivisionInProgress($_SESSION['divisionID']); } else { $progress->getRefererInProgress($_SESSION['userID']); } parent::data_grid($progress, 'progress_list.html'); } On 13/04/2005, at 11:53 PM, Ian P. Christian wrote:
I'm interested to see if anyone has come up with a nice paging system using Flexy and DB_DataObject, ideally the formatting of the pager and the number of results per page should be done in the template. One huge issue I've come across with limiting DB_DO objects from the template would be running a while loop over it, because flexy doesn't offer a while loop feature. I would be very interested to hear how people have intergrated these classes. I could do the while loop in the Page class pushing data into an array, and then the template can do a foreach over the array, but this is inefficient and wouldn't allow for results-per-page limiting on the template. Ideas/Suggestsions very welcome! Kind Regards, Ian -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.pear.general (#18725) next »