DtDdWrapper in Zend Framework

我尝试着用 Zend Framework 重写了一个程序。在 Zend_Form 上徘徊了好久,研读了 Programmer’s Reference Guide N 遍,还是没有融会贯通。比如说,我想去掉默认的DtDdWrapper,用 $element->removeDecorator(‘DtDdWrapper’); 只对某些element起作用,对 Zend_Form_Element_Text 怎么也不起作用,最后发现用 $element->removeDecorator(‘HtmlTag’); 倒可行。 问题是解决了,但还是没摸清 Zend Framework 设计思路。很累。 续: 其实,用$element->removeDecorator(‘HtmlTag’); 问题并没有完全解决。后来我用 var_dump($element->getDecorators()); 查看了默认加载的装饰器以及装饰器的参数,发现对于 Zend_Form_Element_Text 来说,它的 dt 和 dd 并不是由 DtDdWrapper 加载的,事实上 Zend_Form_Element_Text 默认不加载 DtDdWrapper,难怪 $element->removeDecorator(‘DtDdWrapper’); 是不起作用的。 那么,Zend_Form_Element_Text 的 dt 和 dd 是哪里来的呢?我仔细看了 var_dump 的结果,发现 dt 是由默认的 Label 装饰器默认的 dt 参数带来的 dd 是由默认的… Continue reading DtDdWrapper in Zend Framework

Published
Categorized as 小小草 Tagged