2011-02-14 68 views
0

我想提出這樣一個:Zend Framework:如何訂購裝飾者正確?

<div><input type="checkbox" /> <label>Check this</label></div> 

但不喜歡這樣:

<div><label>Check this</label><input type="checkbox" /></div> 

我試着這樣做:

$stayInSystem->addDecorators(array(
        'ViewHelper', 
        array('Label'), 
        array(array('row' => 'HtmlTag'), array('tag' => 'div',)), 
    ))->setLabel('Check this'); 

在此先感謝

+0

當你試圖這樣做時發生了什麼? – 2011-02-14 19:54:26

回答

1

Decorator for Label的順序由Zend_Form_Decorator_La中的「$ _placement」設置BEL。 可以創建這個類的推導,並設置:

protected $_placement = 'APPEND'; 

在其它方式,有可能通過「陣列(‘放置’=>‘APPEND’)」在addDecorator,像這樣:

$stayInSystem->addDecorators(array(
       'ViewHelper', 
       array('Label', array('placement'=>'APPEND')), 
       array(array('row' => 'HtmlTag'), array('tag' => 'div',)), 
))->setLabel('Check this'); 

希望它的幫助下,你...

阿卡。