QFC and Templates

From: Date: Mon, 01 Mar 2004 18:55:54 +0000
Subject: QFC and Templates
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-11042@lists.php.net to get a copy of this message
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, ~ I want to use QuickForm_Controller to build a multi-page 'wizard' type form. I am developing a separate static IT template for each page, and what I can't figure out from the documentation or examples is, how can I associate a different template with each page. That is, in order to use a template render, I think I subclass HTML_QuickForm_Action_Display and provide an implementation of the method _renderForm(). Somewhere in _renderForm(), I think, I need to somehow figure out what page I'm trying to render, and load the correct template file. For example: class PageOne extends HTML_QuickForm_Page {
~    function buildForm()
~    {
~        $this->_formBuilt = true;
//stuff for creating the first page of the wizard.
~    }
} class PageTwo extends HTML_QuickForm_Page {
~    function buildForm()
~    {
~        $this->_formBuilt = true;
//stuff for creating the second page of the wizard.
~    }
} class ActionDisplay extends HTML_QuickForm_Action_Display {
~    function _renderForm(&$page)
~    {
~        require_once 'HTML/QuickForm/Renderer/ITStatic.php';
~        $tpl =& new HTML_Template_IT('./templates');
//somehow figure out what page I'm processing and load the //appropriate template file. //Below, someMethod() lets me figure out what page I'm actually //processing, hopefully. if ($page->someMethod() == 'page1')
~        {
$tpl->loadTemplateFile('page1.html'); } else if ($page->someMethod() == 'page2')
~        {
$tpl->loadTemplateFile('page2.html'); }
~        $renderer =& new HTML_QuickForm_Renderer_ITStatic($tpl);
~        $page->accept($renderer);
~        $tpl->show();
~    }
} -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFAQ4c0/djDnfAeGysRAi2rAKDO2Nelb7E6/uNt7gUyM3i19OIrMwCgiJe5 B33B9OFhdCv0lyjEU7bAkBE= =7Xfs -----END PGP SIGNATURE-----

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