下面的代碼:如何在Zend Framework中使用現有的裝飾器?
$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');
是可能其他變化編寫自定義裝飾?
謝謝。似乎邏輯:) – prostynick 2010-11-29 13:52:35