Re: Structures_DataGrid HTML_Template_Flexy renderer
| From: | Mark Wiesemann | Date: | Tue, 07 Jun 2005 08:24:03 +0000 |
| Subject: | Re: Structures_DataGrid HTML_Template_Flexy renderer | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-19498@lists.php.net to get a copy of this message | ||
Dan Rossi wrote:
> I had been advised to take this out, however I cant work out a
> way to get this function from outside the renderer to the
> template ??
My suggestion: Add something like the following to your renderer:
function setFlexy(&$flexy)
{
$this->_flexy = &$flexy;
}
Then construct the flexy object in your script (the script that uses
SDG) and pass this object to SDG like this:
$dg->renderer->setFlexy($flexy);
If you add a variable "statistics" to your template, then you could use
$statistics = 'page ' . $dg->getCurrentPage() . ' from ' .
$dg->getPageCount() . ', record ' . $dg->getCurrentRecordNumberStart()
.. ' to ' . $dg->getCurrentRecordNumberEnd() . ' from ' .
$dg->getRecordCount();
for this new template variable.
If you want to use your setTemplate() function in the renderer class,
then add a getFlexyObject() function to it which does only the
following: return $this->_flexy;
Or, even better: Write a getFlexy() function that is used by render().
Both will return the flexy object that you can use then the way I
described above. (Look into the Smarty renderer - it's done there like
this.)
Mark