public function setUp()
 {
     phViewLoader::setInstance(new phFileViewLoader(realpath(dirname(__FILE__) . '/../../examples/datetime')));
     $this->dateTimeForm = new phDateTime('test', 'dateTimeView', 1999, 2001);
 }
 public static function setInstance(phViewLoader $instance)
 {
     self::$_instance = $instance;
 }
 * Simple registration form example
 *
 * @author Rob Graham <*****@*****.**>
 * @package phform
 * @subpackage examples.registration
 */
/*
 * phLoader handles the loading of various Minacl classes
 */
require_once dirname(__FILE__) . '/../../lib/form/phLoader.php';
phLoader::registerAutoloader();
/*
 * register a file view loader so Minacl knows where
 * to look for form view files
 */
phViewLoader::setInstance(new phFileViewLoader(dirname(__FILE__)));
/*
 * create a phForm instance.  The first argument specifies the name
 * of the post or get array that will have the forms data (so register[...])
 * The second argument is the form template to use.
 */
$form = new phForm('register', 'registerForm');
/*
 * set the various validators
 */
$form->fullname->setValidator(new phRequiredValidator());
// note that fullname is the value of the name helper in the form and NOT the id helper
$form->email->setValidator(new phRequiredValidator());
$form->password->setValidator(new phRequiredValidator());
$form->confirmPassword->setValidator(new phCompareValidator($form->password, phCompareValidator::EQUAL));
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
 protected function parseDom($_view)
 {
     /*
      * All the variables in this method start with _ (underscore)
      * so they don't conflict with any custom vars that need to be
      * passed through to the view (which we will build up now)
      */
     foreach ($this->_customVars as $_name => $_value) {
         ${$_name} = $_value;
     }
     /*
      * Now include the template and catch it's output
      */
     ob_start();
     echo "<!DOCTYPE phformdoc [\n";
     /*
      * include the xhtml entity definitions so there are
      * no parsing errors when coming across special entities
      * like &nbsp;
      */
     echo $this->_docTypeDecl;
     echo "\n]>";
     echo "<phformdoc>";
     require phViewLoader::getInstance()->getViewFileOrStream($_view);
     echo "</phformdoc>";
     $_xml = ob_get_clean();
     try {
         $_dom = new SimpleXMLElement($_xml);
         return $_dom;
     } catch (Exception $_e) {
         throw new phFormException("Unparsable html in view '{$_view}', parser said: {$_e->getMessage()}");
     }
 }
 * @author Rob Graham <*****@*****.**>
 * @package phform
 * @subpackage examples.registration2
 */
/*
 * phLoader handles the loading of various Minacl classes
 */
require_once dirname(__FILE__) . '/../../lib/form/phLoader.php';
phLoader::registerAutoloader();
/*
 * register a file view loader so Minacl knows where
 * to look for form view files (this time we are 
 * looking in the folder of the first example so we
 * can re-use our form template)
 */
phViewLoader::setInstance(new phFileViewLoader(dirname(__FILE__) . '/../registration'));
/*
 * include and create our RegisterForm instance that 
 * has all the validators embedded in it
 */
require_once 'RegisterForm.php';
$form = new RegisterForm('register', 'registerForm');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    /*
     * data has been posted back, bind it to the form
     */
    $form->bindAndValidate($_POST['register']);
    if ($form->isValid()) {
        /*
         * form data is valid, put your code to
         * register a new user here
 protected function setUp()
 {
     phViewLoader::setInstance(new phFileViewLoader(realpath(dirname(__FILE__) . '/../resources')));
 }