<?php
class 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' => '用户名:',
));
$password = $this->addElement('password', 'password', array(
'filters' => array('StringTrim'),
'validators' => array(
'Alnum',
array('StringLength', false, array(6, 20)),
),
'required' => true,
'label' => '密 码:',
));
$captcha = $this->addElement('captcha', 'captcha', array(
'captcha' => array(
// First the type...
'captcha' => 'Image',
// Length of the word...
'wordLen' => 6,
'fontsize'=>16,
'width' => 100,
'height' => 38,
'dotNoiseLevel'=>2,
// Captcha timeout, 5 mins
'timeout' => 300,
// What font to use...
'font' => $_SERVER["DOCUMENT_ROOT"].'/webapp/views/scripts/arial.ttf',
// Where to put the image
'imgDir' => $_SERVER["DOCUMENT_ROOT"].'/webroot/images/',
// URL to the images
// This was bogus, here's how it should be... Sorry again :S
'imgUrl' => 'http://yemaosheng.com/webroot/images/',
),
'label' => '验证码:'
));
$login = $this->addElement('submit', 'login', array(
'required' => false,
'ignore' => true,
'label' => '登录',
));
// We want to display a 'failed authentication' message if necessary;
// we'll do that with the form 'description', so we need to add that
// decorator.
$this->setDecorators(array(
'FormElements',
array('HtmlTag', array('tag' => 'dl', 'class' => 'zend_form')),
array('Description', array('placement' => 'prepend')),
'Form'
));
}
}
?> |
Pretty good post. I just came by your site and wanted to say
that I have really liked reading your posts. Any way
I’ll be subscribing to your blog and I hope you post again soon!