RE: [PEAR] Structures_DataGrid question - do I need to use DB_DataObject?
| From: | Prue | Date: | Fri, 18 Nov 2005 07:37:24 +0000 |
| Subject: | RE: [PEAR] Structures_DataGrid question - do I need to use DB_DataObject? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-21979@lists.php.net to get a copy of this message | ||
For anyone (like me) not keen on writing a custom SDG renderer, it's
possible to use SDG with Smarty templates without any mods to the standard
SDG renderer. In the script:
$pagingHtml = $renderer->getPaging();
$pagepointers = '<p class="paging">Pages : ' . $pagingHtml .
'</p>';
$pagecount = '<b>Page ' . $dg->getCurrentPage() . ' of ' .
$dg->getPageCount() . ' - Records ' . $dg->getCurrentRecordNumberStart() .. '
to ' . $dg->getCurrentRecordNumberEnd() . ' of ' . $dg->getRecordCount() ..
'</b>';
// Get a reference to the HTML Renderer object
$dg->renderer->toHtml();
//after setting up the Smarty environment...
if (isset($pagingHtml)){
$tpl->assign ('pagepointers', $pagepointers);
}
if (isset($pagecount)){
$tpl->assign ('pagecount', $pagecount);
}
if (isset($dg)){
$tpl->assign ('thegrid', $dg);
}
// Parse and display the template
$tpl->display('yourtemplatename.tpl');
and in the Smarty template:
{$pagepointers}
{$thegrid->render()}<br />
{if $pagecount}<center>{$pagecount}</center>{/if}
Hope this is helpful,
Prue
-----Original Message-----
From: arnaud sellenet bodin [mailto:demental@free.fr]
Sent: Friday, 18 November 2005 6:23 AM
To: pear-general@lists.php.net
Subject: Re: [PEAR] Structures_DataGrid question - do I need to use
DB_DataObject?
I modified the HTML_Table renderer so that it can render tthe datagrid
as an array, for smarty-static template for example. It's a quick mod,
with few doc and may have bugs and limitations, but if some of you are
interested I can mail it here.
Le 17 nov. 05, à 17:09, Olivier Guilyardi a écrit :
> Mark Wiesemann wrote:
>> Olivier Guilyardi wrote:
>>
>>> IMHO it's not only a matter of comfort. Just read the current
>>> renderers : to
>>> write your own one, you need to know Structures_DataGrid as we
>>> developers do.
>>
>> Yes, that's true. I just wanted to say that it is possibly to write
>> custom renderer, although it is not that easy.
>
> I agree you. The renderer layer already is driver based. It is
> possible to write
> custom drivers, altough it's a complex task. The refactoring is about
> improving
> the driver interface, to allow users to quickly write renderers that
> fit their
> specific needs.
>
> Once again, if anybody on this list have (successful or not)
> experiences with
> tweaking/writing renderers, other thoughts/ideas, etc..., please go
> and give
> your point of view on bug #5859 :
> http://pear.php.net/bugs/bug.php?id=5859
>
> --
> og
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
\ | /
Arnaud Sellenet-Bodin
Dév et dés
http://demental.info
Tel : 05 63 55 24 46
/ | \
--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php