Zend framework Zend表格,表格装饰
我有一个难以置信的困难时期来装饰我需要的Zend表单。这是我需要的HTML结构:Zend framework Zend表格,表格装饰,zend-framework,zend-form,zend-decorators,Zend Framework,Zend Form,Zend Decorators,我有一个难以置信的困难时期来装饰我需要的Zend表单。这是我需要的HTML结构: <table> <thead><tr><th>one</th><th>two</th><th>three</th><th>four</th></thead> <tbody> <tr> <td><input type='checkb
<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>
我尝试了一些td和tr的装饰组合,但迄今为止没有成功
谢谢你的帮助,非常感谢。
JP Levac看看这个。它将解释装饰器是如何工作的,这样您就知道发生了什么以及如何编写自己的装饰器,然后以一个表格示例结束
Zend_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'
));
}
}