Html CAKEPHP3表单输入div in div

Html CAKEPHP3表单输入div in div,html,cakephp,input,cakephp-3.0,Html,Cakephp,Input,Cakephp 3.0,我最近使用CakePHP3启动了一个新项目。我必须为输入框生成一个特定的表单,因为我使用的是AdminLTE V2。 管理员LTE所需的HTML如下 <div class="form-group"> <label for="inputEmail3" class="col-sm-2 control-label">Email</label> <div class="col-sm-10"> <input class

我最近使用CakePHP3启动了一个新项目。我必须为输入框生成一个特定的表单,因为我使用的是AdminLTE V2。 管理员LTE所需的HTML如下

<div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">Email</label>

    <div class="col-sm-10">
        <input class="form-control" id="inputEmail3" placeholder="Email" type="email">
    </div>
</div>
<div class="form-group input text required">
    <label class="col-sm-3 control-label" for="full-name">Full Name</label>
    <input type="text" name="full_name" class="form-control" required="required" maxlength="100" id="full-name">
</div>

电子邮件
我已经生成它如下

<div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">Email</label>

    <div class="col-sm-10">
        <input class="form-control" id="inputEmail3" placeholder="Email" type="email">
    </div>
</div>
<div class="form-group input text required">
    <label class="col-sm-3 control-label" for="full-name">Full Name</label>
    <input type="text" name="full_name" class="form-control" required="required" maxlength="100" id="full-name">
</div>

全名

我需要生成内部的
。我怎么能做到?请帮助。

您可以使用普通html,正如@Manohar所说的那样。但如果您真的喜欢cakephp的语法,我会在我的项目中使用这种语法(相同的主题):



您可能需要一些额外的参数来完成纯html版本代码中编写的工作。您可以在cakephp的文档中查看其表单的其他选项:

您可以使用纯html,正如@Manohar所说。但如果您真的喜欢cakephp的语法,我会在我的项目中使用这种语法(相同的主题):



您可能需要一些额外的参数来完成纯html版本代码中编写的工作。您可以在cakephp的文档中查看cakephp表单的其他选项:

为此cakephp提供自定义模板FormHelper。与CakePHP中的许多帮助程序一样,FormHelper使用字符串模板格式化它创建的HTML。而默认模板是一组合理的默认模板。您可能需要自定义模板以适合您的应用程序

下面我已经根据AdminLTE自定义了输入字段

echo $this->Form->input('email', [
'label' => ['text' => 'Email','class' => 'col-sm-2'],
'templates' => [
'label' => '<label{{attrs}}>{{text}}</label>',
'input' => '<div class="col-sm-10"><input type="{{type}}" name="{{name}}"  {{attrs}}/></div>',
'inputContainer' => '<div class="form-group {{type}}{{required}}">{{content}}</div>',
'inputContainerError' => '<div class="form-group  {{type}}{{required}} has-error">{{content}}{{error}}</div>',
],
]);
echo$this->Form->input('email')[
“标签”=>[“文本”=>“电子邮件”、“类别”=>“col-sm-2”],
“模板”=>[
'标签'=>'{{text}}',
'输入'=>'',
'inputContainer'=>'{{content}}',
'InputContaineError'=>'{{content}}{{error}}',
],
]);
下面是这个in-AdminLTE主题的输出

<div class="form-group text">
<label class="col-sm-2" for="email">Email</label>
   <div class="col-sm-10">
      <input type="text" name="email" placeholder="Email" id="first-name">
   </div>
</div>

电子邮件

为此CakePhp提供自定义模板FormHelper。与CakePHP中的许多帮助程序一样,FormHelper使用字符串模板格式化它创建的HTML。而默认模板是一组合理的默认模板。您可能需要自定义模板以适合您的应用程序

下面我已经根据AdminLTE自定义了输入字段

echo $this->Form->input('email', [
'label' => ['text' => 'Email','class' => 'col-sm-2'],
'templates' => [
'label' => '<label{{attrs}}>{{text}}</label>',
'input' => '<div class="col-sm-10"><input type="{{type}}" name="{{name}}"  {{attrs}}/></div>',
'inputContainer' => '<div class="form-group {{type}}{{required}}">{{content}}</div>',
'inputContainerError' => '<div class="form-group  {{type}}{{required}} has-error">{{content}}{{error}}</div>',
],
]);
echo$this->Form->input('email')[
“标签”=>[“文本”=>“电子邮件”、“类别”=>“col-sm-2”],
“模板”=>[
'标签'=>'{{text}}',
'输入'=>'',
'inputContainer'=>'{{content}}',
'InputContaineError'=>'{{content}}{{error}}',
],
]);
下面是这个in-AdminLTE主题的输出

<div class="form-group text">
<label class="col-sm-2" for="email">Email</label>
   <div class="col-sm-10">
      <input type="text" name="email" placeholder="Email" id="first-name">
   </div>
</div>

电子邮件

使用蛋糕之友引导插件,可从


它已经包括了对基于引导的主题的完全支持。

使用蛋糕之友引导插件,可在


它已经包括了对基于引导的主题的完全支持。

您可以发布视图中用于生成表单的代码吗?。如果您确切地知道您需要什么,为什么每次都使用表单帮助器?直接使用html。你能发布你在视图中用来生成表单的代码吗?如果你确切地知道你需要什么,为什么每次都使用表单助手?直接使用html。