Html Zend框架:如何正确订购装饰器?

Html Zend框架:如何正确订购装饰器?,html,zend-framework,label,decorator,Html,Zend Framework,Label,Decorator,我想做一个这样的: <div><input type="checkbox" /> <label>Check this</label></div> 提前感谢在Zend\u Form\u Decorator\u Label中,标签的装饰顺序由“$\u placement”设置。 您可以创建此类的派生并设置: protected $_placement = 'APPEND'; 换句话说,可以在addDecorator中传递“array('

我想做一个这样的:

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

提前感谢

在Zend\u Form\u Decorator\u Label中,标签的装饰顺序由“$\u placement”设置。 您可以创建此类的派生并设置:

protected $_placement = 'APPEND';
换句话说,可以在addDecorator中传递“array('placement'=>'APPEND'),如下所示:

<div><label>Check this</label><input type="checkbox" /></div>
$stayInSystem->addDecorators(array(
              'ViewHelper',
              array('Label', array('placement'=>'APPEND')),
              array(array('row' => 'HtmlTag'), array('tag' => 'div',)),
))->setLabel('Check this');
希望对你有帮助


Aka.

当您尝试这样做时发生了什么?并尝试将
addDecorators
替换为
setDecorators
。因此,我解决了这个问题。刚刚添加:数组('Label',数组('placement'=>'append'))。
$stayInSystem->addDecorators(array(
              'ViewHelper',
              array('Label', array('placement'=>'APPEND')),
              array(array('row' => 'HtmlTag'), array('tag' => 'div',)),
))->setLabel('Check this');