1

Zend_Form では、デコレータを使用してテキストを含む 1 組の html タグを要素の先頭に追加できますか?どのように?

元:

<div>My text inside html tags prepended..</div><input type='text'>

編集:

また、まだテキストが含まれている 1 対の html タグにフォーム要素を配置したい場合はどうすればよいでしょうか?

元。

<div>
 This div is containing both my custom text and my form element: 
 <input type='text'>
</div>

ありがとう

ルカ

4

1 に答える 1

2

使用するだけ

 $element->setDescription("My text");

必要に応じてラベルを使用することもできます。

必要に応じて、デコレータでも使用されるHtmlTagヘルパーを使用し、位置をPREPENDに設定できます。

編集

$elementDecorators = array(
                                'ViewHelper',
                                array('Label', array( 'tag' => 'span', 'placement' => 'prepend')),
                                array('Description', array( 'tag' => 'div', 'placement' => 'append','class'=>'eDesc')),                                
                                array('HtmlTag', array( 'tag' => 'div', 'class'=>'userElement'))
);

$element->setDecorators( $elementDecorators);
于 2011-05-26T12:52:10.503 に答える