* @license LGPL, see license.txt for details * @link http://www.php-tools.net */ /** * Main examples prepend file, needed *only* for the examples framework! */ include_once 'patExampleGen/prepend.php'; $exampleGen->displayHead( 'Example' ); // EXAMPLE START ------------------------------------------------------ /** * main patForms class */ require_once $neededFiles['patForms']; /** * patForms parser class */ require_once $neededFiles['patForms_Parser']; /** * patErrorManager class */ require_once $neededFiles['patErrorManager']; /** * localisation stuff */ require_once $neededFiles['patI18n_configure']; // set namespace and cache dir patForms_Parser::setNamespace( "patForms" ); patForms_Parser::setCacheDir( "cache" ); // set the placeholders to use for patForms elements. These placeholders will // be inserted in the form template file that is created by the createFormFromTemplate() // call - in this case, we use PHP placeholders to access the elements. patForms_Parser::setPlaceholder( 'getElementById("%s"); echo $el->serialize(); ?>', 'keep' ); // set the placeholders for the form tags themselves - here we also use PHP tags patForms_Parser::setFormPlaceholders( 'serializeStart(); ?>', 'serializeEnd(); ?>' ); // now read the form template and write our new form template output with the PHP // placeholders. Have a look at the file after running this example to see how that // looks like. $form =& patForms_Parser::createFormFromTemplate( null, "templates/example_parser_placeholder.fhtml", "templates/example_parser_placeholder.html" ); // and here's how you can render a form using templates without setting any renderer // at all - we simply include the template file. The PHP placeholders will then be // executed using the form object created with the createFormFromTemplate() call. include 'templates/example_parser_placeholder.html'; // EXAMPLE END ------------------------------------------------------ $exampleGen->displayFooter(); ?>