2011-07-29 4 views
0

기본적으로 Zend에서 제공하는 표준 dt 및 dd 태그를 라디오 버튼 목록에 대해 ul 및 li을 사용하도록 설정하려면 어떻게해야합니까?라디오 버튼이있는 젠드 장식기?

그래서 최종 결과임을 :

UL 태그

리튬 태그 라디오 버튼 1 단부 리 태그

리튬 태그 라디오 버튼 2 단부 리 태그

리튬 태그 라디오 버튼 (3) 엔드 리 태그

최종 UL 태그

전 dl dt 태그의 nstead.

감사합니다.

답변

3
당신은 너무처럼, 라디오 버튼 요소에 대한 장식의 사용자 지정 순서를 지정해야합니다

: 나는 젠드 양식을 장식 소원

$this->addElement('radio', 'zipZangZowie', array(
    'decorators' => array(
     'ViewHelper', 
     array(array('AddTheLi' => 'HtmlTag'), array('tag' => 'li')), 
     array(array('AddTheUl' => 'HtmlTag'), array('tag' => 'ul')), 
     'Errors', 
     array('Description', array('tag' => 'p', 'class' => 'description')), 

     // specifying the "div" tag to wrap your <label> elements is not strictly 
     // necessary, but it produces valid XHTML if your form elements are wrapped 
     // in block-level tags like "<li>" (see next comment) 
     array('Label', array('tag' => 'div')), 

     // uncomment the following if all of your form elements are wrapped in "<li>" 
     //array('HtmlTag', array('tag' => 'li')), 
    ), 
    'disableLoadDefaultDecorators' => true, 
    'label' => 'Zip Zang Zowie', 
    'separator' => '</li><li>', 
    'attribs' => array(
     'options' => array(
      'foo' => 'Option 1', 
      'bar' => 'Option 2', 
      'baz' => 'Option 3' 
     ), 
    ), 
)); 

그렇게 복잡하지 않았다. 어쨌든 위의 데코레이터 배열은 Zend의 기본 데코레이터를 기반으로합니다. 원하는대로 더 사용자 지정할 수 있습니다. 개별 라디오 버튼을 목록으로 묶는 핵심 부분은 separator 속성입니다.이 속성은 ZF에게 각 라디오 버튼 세그먼트 사이에 배치 할 내용과이 블록을 바깥 쪽 <ul><li>...</li></ul> 태그에 래핑하는 두 개의 추가 HtmlTag 래퍼로 지정합니다.

관련 문제