[QuickForm_Controller] free the templates! qf_ct for president!
| From: | Matthias H. Risse | Date: | Tue, 14 Oct 2003 12:05:14 +0000 |
| Subject: | [QuickForm_Controller] free the templates! qf_ct for president! | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-8418@lists.php.net to get a copy of this message | ||
hello quickFormers!
i am trying to find a clean solution for telling a quickform_controller object to display each "subpage" using a specific template. currently i overwrite the _renderForm-method (as stated in the man) of the action_display-class with the following, but this of course just works when using always the same dynamic template, but not if i need different
templates for each multipage.
<?PHP
class smartyDynamicDisplay extends HTML_QuickForm_Action_Display
{
function _renderForm(&$page)
{
global $tpl;
$renderer =& new HTML_QuickForm_Renderer_SmartyDynamic();
// $renderer =& new HTML_QuickForm_Renderer_Array();
$page->accept($renderer);
$toArray = $renderer->toArray();
$tpl->assign('form', $toArray);
/*
echo "<pre>";
var_dump($toArray);
echo "</pre>";
*/
}
}
?>
the instance of the template-engine later displays the content when being called from somewhere else, but this should really be the current problem.
possibly my true problem is, that i need to store somewhere the name of the template to be used for each multipage and dont know where to do it.
i am seeking for a clean solution, but somehow i am actually a little bit lost in space.
i am thinking about adding a select statement somewhere (maybe in the class wrapping the controller class), but all in all this seems to be
pretty much overhead and kinda bad style, because in this context i would prefer the controller-instance itself to know how to render its
various pages.
..or maybe its better to handle all this using a single (gigantic) dynamic template and stop to macerate the MVC pattern?
does anyone have experiences or ideas regarding this topic?
yours,
--M
ps: i know globals are not a good style, but sometimes i dont really know if its really better to pass around references though various
classes.