zend-framework – Zend Form,表装饰器
发布时间:2020-12-13 18:10:51 所属栏目:PHP教程 来源:网络整理
导读:我正以非常困难的时间以我需要的方式装饰Zend.这是我需要的 HTML结构: tabletheadtrthone/ththtwo/thththree/ththfour/th/theadtbodytr tdinput type='checkbox' id='something'//td tdimg src='src'//td tdinput type='text' id='something'//td tdinput t
我正以非常困难的时间以我需要的方式装饰Zend.这是我需要的
HTML结构:
<table> <thead><tr><th>one</th><th>two</th><th>three</th><th>four</th></thead> <tbody> <tr> <td><input type='checkbox' id='something'/></td> <td><img src='src'/></td> <td><input type='text' id='something'/></td> <td><input type='radio' group='justonegroup'/></td> </tr> <tr> <td><input type='checkbox' id='something'/></td> <td><img src='src'/></td> <td><input type='text' id='something'/></td> <td><input type='radio' group='justonegroup'/></td> </tr> </tbody> </table> 正文中的行数由我的表单类中的循环结构决定.当然,所有ID都是独一无二的.表单中的所有单选按钮属于一个组.我的问题是我不确定如何创建然后在我的表中设置Zend_Form_Element_MultiCheckbox和Zend_Form_Element_Radio对象的样式.在哪里/如何将相应的装饰器应用于复选框和单选按钮以获得如上所述的表单结构? 到目前为止我的Form类: class Form_ManageAlbums extends Zend_Form { public function __construct($album_id) { $photos = Model_DbTable_Photos::getAlbumPhotos($album_id); $selector = new Zend_Form_Element_MultiCheckbox('selector'); $radio = new Zend_Form_Element_Radio('group'); $options = array(); while($photo = $photos->fetchObject()) { $options[$photo->id] = ''; $image = new Zend_Form_Element_Image('image'.$photo->id); $image->setImageValue('/dog/upload/'.$photo->uid.'/photo/'.$photo->src); $caption = new Zend_Form_Element_Text('caption'.$photo->id); $caption->setValue($photo->caption); $this->addElements(array($image,$caption)); } $selector->addMultiOptions($options); $radio->addMultiOptions($options); $this->addElement($selector); $this->setDecorators(array( 'FormElements',array('HtmlTag',array('tag' => 'table')),'Form' )); } } 我为td和tr尝试了一些装饰器的组合,但迄今为止没有成功. 感谢您的帮助,非常感谢.
这是一个使用zend表单装饰器创建表格布局的教程:
Tutorial – Create Zend Framework Form with table layout using decorators
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |