public function setUp() { phViewLoader::setInstance(new phFileViewLoader(realpath(dirname(__FILE__) . '/../../examples/datetime'))); $this->dateTimeForm = new phDateTime('test', 'dateTimeView', 1999, 2001); }
* @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
* 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 setUp() { phViewLoader::setInstance(new phFileViewLoader(realpath(dirname(__FILE__) . '/../resources'))); }