【发布时间】:2010-11-29 13:33:11
【问题描述】:
以下代码:
$this->addElement('text', 'email', array(
'label' => 'Your email address:',
));
$this->addElement('submit', 'submit', array(
'label' => 'Sign Guestbook',
));
生成以下 HTML:
<form enctype="application/x-www-form-urlencoded" action="" method="post">
<dl class="zend_form">
<dt id="email-label">
<label for="email" class="optional">Your email address:</label>
</dt>
<dd id="email-element">
<input type="text" name="email" id="email" value="" />
</dd>
<dt id="submit-label">
 
</dt>
<dd id="submit-element">
<input type="submit" name="submit" id="submit" value="Sign Guestbook" />
</dd>
</dl>
</form>
我知道,我可以编写自己的装饰器,但我想知道,如何使用现有的装饰器来创建以下 HTML:
<form enctype="application/x-www-form-urlencoded" action="" method="post">
<div>
<label for="email" class="optional">Your email address:</label>
<input type="text" name="email" id="email" value="" class="my_class" />
</div>
<div>
<input type="submit" name="submit" id="submit" value="Sign Guestbook" class="my_class" />
</div>
</form>
没有<dl/>、<dt/>、<dd/>,添加了class属性。
比如我知道,怎么去掉周围的<dl/>标签:
$this->addDecorator('FormElements')
->addDecorator('Form');
是否可以在编写自定义装饰器的情况下进行其他更改?
【问题讨论】:
标签: php html zend-framework zend-form zend-decorators