2013-02-28 4 views
0

에는 사용자 정의 HTML 마크 업을 만드는 방법에 대한 자습서가 필요합니다 (예 : Zend 1의 양식 데코레이터). 내가 같은 것을 생성 할 : 양식 요소 usernamepassword 명명 된 가정Zend Form 사용자 정의 HTML 마크 업

<ul> 
<li> 
    <label class="required"><span>*</span> Username</label> 
    <input id="username" name="username" type="text"> 
</li> 
<li> 
    <label class="required"><span>*</span> Password</label> 
    <input id="password" name="password" type="password"> 
</li> 
</ul> 
+0

당신은 단순히 자신의 뷰 헬퍼를 구현해야합니다 원하는 출력을 줄 것이다 예입니다 이런 종류의 마크 업을 처리 할 수 ​​있습니다. 그것은 그것만큼 간단합니다 :) – Ocramius

답변

1

을 여기

<?php 
// attributes to apply to label(s) 
$labelAttr = array('class' => 'required'); 
// extra label content (assumes Username and Password are already present in the given elements) 
$labelSpan = '<span>*</span> '; 
// set the label attributes 
$form->get('username')->setLabelAttributes($labelAttr); 
$form->get('password')->setLabelAttributes($labelAttr); 
?> 

<ul> 
<li> 
    // use the formLabel helper, hand it the extra label content, and tell it to place the existing label after it 
    <?php echo $this->formLabel($form->get('username'), $labelSpan, 'append'); 
    <?php echo $this->formInput($form->get('username'); 
</li> 
<li> 
    <?php echo $this->formLabel($form->get('password'), $labelSpan, 'append'); 
    <?php echo $this->formInput($form->get('password'); 
</li> 
</ul>