【问题标题】:Cakephp 2 Form HelperCakephp 2 表单助手
【发布时间】:2016-09-06 14:10:54
【问题描述】:

如何使用 Cakephp 表单助手生成以下 HTMl:

<div class="form-group">
<label for="input-Default" class="col-sm-2 control-label">Default</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="input-Default">
</div>
</div>

谢谢

【问题讨论】:

    标签: cakephp-2.0 form-helpers


    【解决方案1】:

    您需要的一切都在 Html 帮助程序中。

    echo $this->Html->div('form-group',
        $this->Html->tag('label', 'Default',
            array(
                'for' => 'input-Default',
                'class' => 'col-sm-2 control-label',
            )
        ) .
        $this->Html->div('col-sm-10',
            $this->Form->input('',
                array(
                    'type' => 'text',
                    'class' => 'form-control',
                    'id' => 'input-Default',
                    'div' => false,
                    'label' => false
                )
            )
        )
    );
    

    http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多