1

如果我想用 cakephp 2.x 更改 formhelper 中所有元素的标签和样式

例子

$this->Form->input("name") 生成:

<div class="input number">
<label for="AfiliadoCedula">Cedula</label>
<input name="data[Afiliado][cedula]" type="number" value="12" id="AfiliadoCedula">
<div class="error-message">name error</div>
</div>

为。。改变:

<div class="input number **myclassfieldset**">
<label for="AfiliadoCedula" class="**myclasslabel**">Cedula</label>
<input name="data[Afiliado][cedula]" type="number" class="**myclassinput**" value="12"  id="AfiliadoCedula">
<**label** class="error-message **myclasserror**">name error</**label**>
</div>

非常感谢您的帮助!!

4

1 回答 1

4
$this->Form->input("name", array(
                          'div' => array('class' => '**myclassfieldset**'),
                          'label' => array('class' => '**myclasslabel**'),
                          'class' => '**myclassinput**'
));
于 2012-05-04T15:48:56.403 回答