如何在FOSUserBundle的一个模板中合并登录和注册表单 [英] How to merge login and register form in one template on FOSUserBundle
问题描述
我在我的Symfony应用程序中使用FOSUserBundle, 我在单独的模板中有登录和注册表格.我希望两者都在一个模板中彼此相邻显示.
I am using the FOSUserBundle in my Symfony application, I have the login and register forms in a separate template. I want both in one template to display them next to each other.
请帮助我挽救我的一天!
plz help me save my day !!
推荐答案
1 您需要第一个控制器带有一个呈现login.html.twig
模板的loginAction
.假设此控制器为AcmeUserBundle:Security:login
.
1 You need to have a first controller with a loginAction
that renders a login.html.twig
template. Let's assume this controller is AcmeUserBundle:Security:login
.
2 您需要第二个控制器带有一个呈现register.html.twig
模板的registerAction
.假设此控制器为AcmeUserBundle:Registration:register
2 You need to have a second controller with a registerAction
that renders a register.html.twig
template. Let's assume this controller is AcmeUserBundle:Registration:register
3 创建第三个控制器,例如呈示welcome.html.twig
模板的welcomeAction
,并将上面的控制器嵌入到同一页面中.
3 Create a third controller, for example welcomeAction
that renders a welcome.html.twig
template, and embed the controllers above on the same page.
{# AcmeUserBundle:Welcome:welcome.html.twig #}
{{ render(controller('AcmeUserBundle:Security:login'})) }}
{{ render(controller('AcmeUserBundle:Registration:register'})) }}
有关如何操作的更多信息,请参见此处.嵌入控制器.
See here for more informations on how to embed controllers.
这篇关于如何在FOSUserBundle的一个模板中合并登录和注册表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!