Get Widget

Wednesday, February 5, 2014

zend db connection

 resources.db.adapter = "PDO_MYSQL"  
 resources.db.isDefaultAdapter = true  
 resources.db.params.host = "localhost"  
 resources.db.params.username = ""  
 resources.db.params.password = ""  
 resources.db.params.dbname = "zend_learn"  
 ----------  
 {      
     $form = new User_Form_loginForm();  
     $this->view->form = $form;  
 }  
 -----------  
 class User_Form_loginForm extends Zend_Form  
 {  
   public function init()  
   {  
     $request = Zend_Controller_Front::getInstance()->getRequest();  
     $action = $request->getBaseUrl().'/'.$request->getModuleName().'/'.$request->getControllerName().'/auth';  
     $this->setMethod('post')  
        ->setName('frmlogin')  
        ->setAttrib('id', 'frmlogin')  
        ->setAction($action);  
     $username = $this->createElement('text', 'user_name');  
     $username->setAttrib('class', 'required')  
          ->setAttrib('minlength', 4)  
          ->setAttrib('maxlength', 15)  
          //->addFilter(array('StripTags', 'StringTrim'))  
          ->addFilter('StripTags')  
          ->addFilter('StringTrim')  
          ->setRequired(true);  
     $password = $this->createElement('password', 'password');  
     $password->setAttrib('class', 'required')  
          ->setRequired(true);  
     $submit = $this->createElement('submit', 'login');  
     $this->addElements(array($username, $password, $submit));  
   }  
 }  

No comments:

Post a Comment

 
follow me on Twitter
Get Widget