Home > Backend Development > PHP Tutorial > Paste a custom symfony form skin and apply bootstrap effect_PHP tutorial

Paste a custom symfony form skin and apply bootstrap effect_PHP tutorial

WBOY
Release: 2016-07-13 17:48:39
Original
974 people have browsed it

效果如图

 

 

调用很方便


[html]
{% import "JcyHelperBundle:tmp:jcyForm.html.twig" as forms %} 
{{ forms.jcyForm(dbForm,path('JcyHelperBundle_db_set'),'Connect') }} 
{% import "JcyHelperBundle:tmp:jcyForm.html.twig" as forms %}
{{ forms.jcyForm(dbForm,path('JcyHelperBundle_db_set'),'Connect') }}
现在上源代码[html]
{% macro jcyForm(form,action,submit_name,onSubmitJs) %} 

 
{% if form.vars.errors|length >0 %} 
 
{% for error in form.vars.errors %} 
{% if loop.index>1 %}
{% endif %} 
{{ error.messageTemplate|trans(error.messageParameters, 'validators') }} 
{% endfor %} 
 
{% endif %} 
{% for key,v in form.children %} 
{% if key != '_token' %} 
 
   
 
     
       
 
            {{ form_widget(v) }} 
             
            {% if v.vars.errors|length >0 %} 
            {% for error in v.vars.errors %} 
            {% if loop.index>1 %},{% endif %} 
            {{ error.messageTemplate|trans(error.messageParameters, 'validators') }} 
            {% endfor %} 
            {% endif %} 
           
 
       
 
   
 
 
{% endif %} 
{% endfor %} 
{{ form_rest(form) }} 
 
 
{% endmacro %}


摘自 jiaochangyun的专栏

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/478409.htmlTechArticle效果如图 调用很方便 [html] {% import JcyHelperBundle:tmp:jcyForm.html.twig as forms %} {{ forms.jcyForm(dbForm,path(JcyHelperBundle_db_set),Connect) }} {% import JcyHelper...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template