몇 가지가 있습니다. 자신 만의 요소보기 도우미를 롤백 할 수 있습니다 (곧 추측 할 수 있습니다).
또는 ...이 (매우 기본적인 예)와 같은 형태의 viewscript을 사용할 수
class Your_Form extends Zend_Form
{
public function init()
{
$this->setDecorators(array(
'PrepareElements',
array('ViewScript', array('viewScript' => 'path/to/viewscript.phtml'))
));
// only use basic decorators for elements
$decorators = array(
'ViewHelper',
'Label',
'Errors'
);
// create some element
$someElement = new Zend_Form_Element_Text('someElement');
// set the basic decorators for this element and set a css class
$someElement->setDecorators($decorators)
->setAttrib('class', 'someCssClass');
// add (potentially multiple) elements to this from
$this->addElements(array(
$someElement
));
}
}
가에 대한 standard decorators section about PrepareElements를 참조하십시오 형태의 PrepareElements의 장식 세트를 가지고 필요한 이유 ViewScript 데코레이터를 사용합니다. 그런 다음 viewscript에서
는 :
<?
// the form is available to the viewscript as $this->element
$form = $this->element;
?>
<!-- put whatever html you like in this script and render the basic element decorators seperately -->
<div>
<? if($form->someElement->hasErrors()): ?>
<?= $form->someElement->renderErrors() ?>
<? endif; ?>
<?= $form->someElement->renderLabel(); ?>
<?= $form->someElement->renderViewHelper(); ?>
</div>
감사합니다, 이것이 내가 필요한 것입니다. 건배 – Hanseh