root/trunk/patForms/Parser/SimpleRenderer.php

Revision 320, 1.4 kB (checked in by schst, 3 years ago)

Parser now uses the element's id for the placeholder. Parser_patTemplateRenderer and Parser_SimpleRenderer now use the matching renderers as delegates (fixes bug #184 and #185). This commit may break some scripts, but the parser was labelled alpha before.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?PHP
2 /**
3  * Renderer based on patForms_Parser
4  *
5  * This class can be used as a parser that is also
6  * a renderer. It makes it quite easy to create working
7  * forms from a form template
8  *
9  * $Id$
10  *
11  * @author        Stephan Schmidt <s.schmidt@metrix.de>
12  * @package        patForms
13  * @subpackage    Parser
14  * @license        LGPL
15  * @copyright    PHP Application Tools <http://www.php-tools.net>
16  */
17  
18 /**
19  * Renderer based on patForms_Parser
20  *
21  * This class can be used as a parser that is also
22  * a renderer. It makes it quite easy to create working
23  * forms from a form template
24  *
25  * @author        Stephan Schmidt <s.schmidt@metrix.de>
26  * @package        patForms
27  * @subpackage    Parser
28  * @license        LGPL
29  * @copyright    PHP Application Tools <http://www.php-tools.net>
30  */
31 class patForms_Parser_SimpleRenderer extends patForms_Parser
32 {
33    /**
34     * gathers serialized data from all elements and replaces them in the outputFile.
35     *
36     * @access    public
37     * @param    object    &$patForms            Reference to the patForms object
38     * @param    mixed    $args                optional arguments
39     * @return    string    $html                HTML code
40     */
41     function render(&$patForms, $args = null)
42     {
43         $renderer = &patForms::createRenderer('String');
44         $renderer->setTemplate($this->getHTML());
45         $renderer->setPlaceholder($this->_placeholder, 'id');
46         $renderer->setFormPlaceholders($this->_placeholder_form_start, $this->_placeholder_form_end);
47         
48         return $renderer->render($patForms, $args);
49     }
50 }
51 ?>
Note: See TracBrowser for help on using the browser.