Php 覆盖FOSUserBUndle布局
我在我的项目中安装并配置了FOSUserBundle,我使用的是symfony 4。安装工作顺利完成。 我覆盖了FOSUserBundle模板,但与layout.html.twig和base.html.twig不被覆盖相同 My layout.html.twig:Php 覆盖FOSUserBUndle布局,php,symfony,symfony4,Php,Symfony,Symfony4,我在我的项目中安装并配置了FOSUserBundle,我使用的是symfony 4。安装工作顺利完成。 我覆盖了FOSUserBundle模板,但与layout.html.twig和base.html.twig不被覆盖相同 My layout.html.twig: {% extends 'base.html.twig' %} {% block body %} <div class="container"> <div class="row">
{% extends 'base.html.twig' %}
{% block body %}
<div class="container">
<div class="row">
<div class="col-xs-12">
{% block fos_user_content %}{% endblock %}
</div>
</div>
</div>
{% endblock %}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
{% block stylesheets %}{% endblock %}
</head>
<body>
{% block body %}{% endblock %}
{% block javascripts %}{% endblock %}
</body>
</html>
My base.html.twig:
{% extends 'base.html.twig' %}
{% block body %}
<div class="container">
<div class="row">
<div class="col-xs-12">
{% block fos_user_content %}{% endblock %}
</div>
</div>
</div>
{% endblock %}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
{% block stylesheets %}{% endblock %}
</head>
<body>
{% block body %}{% endblock %}
{% block javascripts %}{% endblock %}
</body>
</html>
只使用了FOSUserBundle。
其次,symfony调试工具栏消失了
FOSUserBundle在此处被覆盖:
模板/捆绑包/FOSUserBundle
在文件夹上,我添加了所有FOSUserBundle子文件夹:
安全
登记
轮廓
我就是这样做的: base.html.twig layout.html.twig Security/login.html.twig
我们在哪里可以在symfony4上存储管理员资产?在公共目录中:
{% extends "bundles/FOSUserBundle/layout.html.twig" %}
{% trans_default_domain 'FOSUserBundle' %}
{% block title %}Sing in{% endblock %}
{% block fos_user_content %}
<div class="jumbotron">
<h4 class="text-center">Sign in</h4>
{% if error %}
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
<form method="post" action="{{ path("fos_user_security_check") }}">
<input type="hidden" name="_csrf_token" value="{{ csrf_token }}"/>
<div class="form-group">
<label for="username">Email:</label>
<input type="email" name="_username" class="form-control" id="username" value="{{ last_username }}"
autocomplete="off">
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" id="password" name="_password" class="form-control">
</div>
<div class="form-group form-check">
<label class="form-check-label">
<input class="form-check-input" type="checkbox" id="remember_me" name="_remember_me" value="on">Remember
me
</label>
</div>
<button name="_submit" type="submit" class="btn btn-primary">{{ 'security.login.submit'|trans }}</button>
</form>
</div>
{% endblock fos_user_content %}