* @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']; // needed options patForms_Parser::setNamespace( "patForms" ); patForms_Parser::setCacheDir( "cache" ); // create the HTML parser $parser =& patForms_Parser::createParser( 'Html' ); // parse the HTML form file $parser->parseFile( 'templates/example_parser_html-source.html' ); // now write the corresponding form template $parser->writeFormTemplate( 'templates/example_parser_html-generated.fhtml' ); // create the form using the form template we just // created. Note the null as third parameter: this is // to avoid that the parser overwrites our html form :) $form =& patForms_Parser::createFormFromTemplate( 'SimpleRenderer', 'templates/example_parser_html-generated.fhtml', 'templates/example_parser_html-output.html' ); // use auto-validation $form->setAutoValidate( 'save' ); // render the content $content = $form->renderForm(); // check the form and display error messages if any if ($form->isSubmitted()) { displayErrors($form); // see the patExampleGen/customFunctions.php file } // now display the form echo $content; // EXAMPLE END ------------------------------------------------------ $exampleGen->displayFooter(); ?>