|
Revision 117, 2.4 kB
(checked in by argh, 4 years ago)
|
Massive update of the examples collection; added the patExampleGen examples framework; commented all examples; reworked all the templates...
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
include_once 'patExampleGen/prepend.php'; |
|---|
| 19 |
$exampleGen->displayHead( 'Example' ); |
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
require_once $neededFiles['patForms']; |
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
require_once $neededFiles['patForms_Parser']; |
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
require_once $neededFiles['patErrorManager']; |
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
patForms_Parser::setNamespace( "patForms" ); |
|---|
| 44 |
patForms_Parser::setCacheDir( "cache" ); |
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
$form =& patForms_Parser::createFormFromTemplate( |
|---|
| 50 |
'SimpleRenderer', |
|---|
| 51 |
'templates/example_parser_simple.fhtml', |
|---|
| 52 |
'templates/example_parser_simple.html' |
|---|
| 53 |
); |
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
$form->setAutoValidate( 'save' ); |
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
$content = $form->renderForm(); |
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
if( $form->isSubmitted() ) |
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
$errors = $form->getValidationErrors(); |
|---|
| 68 |
$errors ) |
|---|
| 69 |
|
|---|
| 70 |
"<b>patForms:</b> validation failed. Errors:<br><br>"; |
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
foreach( $errors as $elementName => $elementErrors ) |
|---|
| 74 |
|
|---|
| 75 |
$elementErrors ) ) |
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
'Field: <b>'.$elementName.'</b>'; |
|---|
| 79 |
"<pre>"; |
|---|
| 80 |
print_r( $elementErrors ); |
|---|
| 81 |
"</pre>"; |
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
"<b>patForms:</b> validation successful.<br><br>"; |
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
|
|---|
| 91 |
echo $content; |
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
$exampleGen->displayFooter(); |
|---|
| 96 |
?> |
|---|