Reputation: 878
this is my form script: located in application/forms and i copy it form here and by the way im using xampp
class Form_LoginForm extends Zend_Form
{
public function init()
{
$username = $this->addElement('text', 'username', array(
'filters' => array('StringTrim', 'StringToLower'),
'validators' => array(
'Alpha',
array('StringLength', false, array(3, 20)),
),
'required' => true,
'label' => 'Your username:',
)); ect.////
}
and this my authentication script.. located in application/controller:
class AuthenticationController extends Zend_Controller_Action {
public function loginAction()
{
$form = new Form_LoginForm(); // doest work
$this->view->form = $form;
$myDb = $this->getAuthAdapter();
$userName = 'user';
$password = 'ds';
$myDb->setIdentity($userName)
->setCredential($password);
}
private function getAuthAdapter(){
$myDb = new Zend_Auth_Adapter_DbTable(Zend_Db_Table::getDefaultAdapter());
$myDb->setTableName('zuser')
->setIdentityColumn('table1')
->setCredentialColumn('table2');
return $myDb;
}
}
i want to call the class form Form_LoginForm inside the AuthenticationController but it gives me and error: *Fatal error: Class 'Form_LoginForm' not found in C:\xampp\htdocs\zendframework\sampleSite\application\controllers\AuthenticationController.php on line 18* my question is what is the right way to call a class forms.. and where is the __autoload located?
Upvotes: 0
Views: 377
Reputation: 9703
Try changing class Form_LoginForm extends Zend_Form
into class Application_Form_LoginFrom extends Zend_Form
and then in you're AuthController $form = new Application_Form_LoginForm
Upvotes: 1