Problem rendering Structures_DataGrid with Smarty
| From: | Andrew Teixeira | Date: | Mon, 26 Jun 2006 15:34:43 +0000 |
| Subject: | Problem rendering Structures_DataGrid with Smarty | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-24465@lists.php.net to get a copy of this message | ||
Hello,
I have been happily using SDG (0.6.3) for a while now in conjunction
with Smarty. Everything was going fine until I decided to upgrade to
the new 0.7.1 system. I downloaded 0.7.1 with all its requisite
DataSource and Renderer packages. I then tried to convert from the
0.6.3 way of doing things to 0.7.1's somewhat different process. So,
before I had something similar to the following:
/* begin snip */
$data =& Structures_DataGrid_DataSource::create($result);
$dataGrid->bindDataSource($data);
$this->_template->assign_by_ref('renderer', $dataGrid->renderer);
$dataGrid->renderer->setSmarty($this->_template);
$dataGrid->renderer->setTemplate(TEMPLATE_DIR . 'template.tpl');
// Print the DataGrid
$template = $dataGrid->renderer->getSmarty();
$html = $template->fetch(TEMPLATE_DIR . 'template.tpl');
/* end snip*/
Now, when trying to convert to the 0.7.1 scheme, I thought the
following should be a reasonable replacement:
/* begin snip*/
$dataGrid->bind($SQLStatement, array('dbc' => $this->_connection));
$renderer =& $dataGrid->getRenderer();
$renderer->setContainer($this->_template);
$dataGrid->fill($this->_template);
$template =& $renderer->getContainer();
$html = $template->fetch(TEMPLATE_DIR . 'template.tpl');
/* end snip */
But, when I run this, I get as far as $dataGrid->fill(), and execution
of the script stops without an error...it just stops. If I comment
out the ->fill() line, I can get to the $template->fetch() line
without issue and retrieve the generated HTML code from Smarty, but
none of the column or record data is filled in. I have tried
everything I can think of to get an error message to appear, but since
I am calling this through AJAX, there isn't as much flexibility of
throwing stubs into the code as they will never be displayed. I was
just hoping that someone could see that I missed a step in setting up
the data grid and that was my problem as opposed to having to figure
out something that is wrong with SDG itself. Any help would be
greatly appreciated. Thank you.
P.S. I am currently running PHP 5.1.4 with MDB2 2.1.0 as the
datasource if that makes any difference.