【问题标题】:How to 'insert' values in tags using Zend Decorators如何使用 Zend 装饰器在标签中“插入”值
【发布时间】:2011-08-10 09:43:03
【问题描述】:

请就使用 Zend 表单装饰器在 HTML 标记之间插入诸如“#”、“名称”和“数字”之类的值提出建议。谢谢

      <thead>
             <tr>
              <th>#</th>
              <th>Name</th>
              <th>Number</th>
             </tr>
      </thead>

编辑: @Asuraya澄清:我已经能够使用下面的装饰器代码生成上面所需的结构。但是,它在标签中没有“#”、“名称”和“编号”的情况下呈现。我一直想不出插入值的方法。

      $subform->setDecorators(array(
     'FormElements',
      array(array('th1' => 'HtmlTag'), array('tag' => 'th')),
      array(array('th2' => 'HtmlTag'), array('tag' => 'th')),
      array(array('th3' => 'HtmlTag'), array('tag' => 'th')),
      array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
      array(array('thead' => 'HtmlTag'), array('tag' => 'thead')),
      array(array('tbody' => 'HtmlTag'), array('tag' => 'tbody', 'placement' => 'APPEND')),
      array(array('table' => 'HtmlTag'), array('tag' => 'table', 'id' => 'tabdata')),
      'Form',
     ));

【问题讨论】:

    标签: zend-framework zend-form zend-decorators


    【解决方案1】:

    您的问题不清楚。 如果您想使用视图脚本在表单中显示值。

    $thead = new Zend_Form_Element_Hidden('thead');
    $thead->setDecorators(
         array(
        array('ViewScript', array('viewScript' => 'thead.phtml'))
        )
    );
    

    thead.phtml 是

    <thead>
    <tr>
      <th>#</th>
      <th>Name</th>
      <th>Number</th>
    </tr>
    </thead>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-24
      • 2010-11-24
      • 1970-01-01
      相关资源
      最近更新 更多