Ver Mensaje Individual
  #17 (permalink)  
Antiguo 07/02/2013, 12:11
wilmer30
 
Fecha de Ingreso: enero-2010
Mensajes: 491
Antigüedad: 14 años, 3 meses
Puntos: 12
Respuesta: formas de usar decordador ViewScript

pues la verdad no se donde pueda estar el problema: este es un completo de mi código LoginForm.php
Código PHP:
Ver original
  1. class Application_Form_LoginForm extends Zend_Form {
  2.    
  3.     public function init() {
  4.        
  5.         $this->setMethod(Zend_Form::METHOD_POST);
  6.         $username = $this->addElement ( 'text', 'username', array (
  7.                 'filters' => array ( 'StringTrim',  'StringToLower' ),
  8.                 'validators' => array ( 'Alpha', array ( 'StringLength',false, array (  3,20 ) ) ),
  9.                 'required' => true,
  10.                 'label' => 'Usuario:'
  11.         ) );
  12.        
  13.         $password = $this->addElement ( 'password', 'password', array (
  14.                 'filters' => array ('StringTrim'),
  15.                 'validators' => array ('Alnum', array ( 'StringLength', false,  array ( 6,  20 ) ) ),
  16.                 'required' => true,
  17.                 'label' => 'Contraseña:'
  18.         ) );
  19.        
  20.         $login = $this->addElement ( 'submit', 'login', array (
  21.                 'required' => false,
  22.                 'ignore' => true,
  23.                 'label' => 'Ingresar'
  24.         ) );
  25.         $login = $this->addElement ( 'submit', 'login', array (
  26.                 'required' => false,
  27.                 'ignore' => true,
  28.                 'label' => 'Ingresar'
  29.         ) );       
  30.        
  31.         $this->setElementDecorators(array('ViewHelper'));
  32.        
  33.         $this->setDecorators(array(
  34.                 array ('ViewScript',    array('viewScript'  => 'login/_login.phtml' )),
  35.                 array ('HtmlTag',       array ('tag' => 'dl','id' => 'login' ) ),
  36.                 array ('Description',   array ('placement' => 'prepend') ),
  37.                 'Form'
  38.         ));
  39.     }  
  40. }
y este es el phtml _login.phtml
Código HTML:
Ver original
  1. <h1>Restrici&oacute;n</h1>
  2. <fieldset id="inputs">
  3.  
  4. <?php echo $this->element->getElement('username'); ?>
  5. <?php echo $this->element->password; ?>
  6.  
  7. <fieldset id="actions">
  8. <?php echo $this->element->getElement('login'); ?>
  9. <a href="">Reg&iacute;strate</a>