Ahora parece que va mejor, pero me sale un nuevo error y no se ve el formulario, es este:
Código:
Warning: Exception caught by form: Image CAPTCHA requires font Stack Trace: #0 C:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\library\Zend\Captcha\Image.php(429):
Zend_Captcha_Image->_generateImage('4c94c3b5fb19ae0...', '88zox6')
#1 C:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\library\Zend\Form\Element\Captcha.php(193):
Zend_Captcha_Image->generate() #2 C:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\library\Zend\Form\Decorator\FormElements.php(101): Zend_Form_Element_Captcha->render()
#3 C:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\library\Zend\Form.php(2904): Zend_Form_Decorator_FormElements->render('')
#4 C:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\library\Zend\Form.php(2920): Zend_Form->render() #5 C:\xampp\htdocs\quickstart\application\modules\default\views\scripts\contact\index.phtml(2):
Zend_Form->__toString() #6 C:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\library\Zend\View.php(108): include('C:\xampp\htdocs...') #7 C:\Program File in C:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\library\Zend\Form.php on line 2925
El caso es que del archivo Contact.php, le he quitado todo el código que tiene que ver con el captcha para ver si así funciona y me sale este warning.
Recuerdo el código de Contact.php, aunque me da que no entra ahí, porque pongo un echo "Algo" y no sale reflejado.
Código PHP:
<?php
class Application_Form_Contact extends Zend_Form
{
public function init ()
{
// Si escribo algo como echo "lo que sea" , no sale luego en la web, es como si no entrara por aquí
// initialize form
$this->setAction('/contact/index')->setMethod('post');
// create text input for name
$name = new Zend_Form_Element_Text('name');
$name->setLabel('Name:')
->setOptions(array('size' => '35'))
->setRequired(true)
->addValidator('NotEmpty', true)
->addValidator('Alpha', true)
->addFilter('HTMLEntities')
->addFilter('StringTrim');
// create text input for email address
$email = new Zend_Form_Element_Text('email');
$email->setLabel('Email address:');
$email->setOptions(array('size' => '50'))
->setRequired(true)
->addValidator('NotEmpty', true)
->addValidator('EmailAddress', true)
->addFilter('HTMLEntities')
->addFilter('StringToLower')
->addFilter('StringTrim');
// create text input for message body
$message = new Zend_Form_Element_Textarea('message');
$message->setLabel('Message:')
->setOptions(array('rows' => '8', 'cols' => '40'))
->setRequired(true)
->addValidator('NotEmpty', true)
->addFilter('HTMLEntities')
->addFilter('StringTrim');
// create captcha
//incluso comentando este código y la llamada posterior da el mismo warning
$captcha = new Zend_Form_Element_Captcha('captcha',
array(
'captcha' => array('captcha' => 'Image', 'wordLen' => 6,
'timeout' => 300, 'width' => 300, 'height' => 100)));
$captcha->setLabel('Verification code:');
// create submit button
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Send Message')->setOptions(
array('class' => 'submit'));
// attach elements to form
$this->addElement($name)
->addElement($email)
->addElement($message)
->addElement($captcha)
->addElement($submit);
$this->addElement($name);
}
}