How to merge login and register form in one template on FOSUserBundle

你离开我真会死。 提交于 2019-12-08 07:22:55

问题


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:


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 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 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.



来源:https://stackoverflow.com/questions/22094974/how-to-merge-login-and-register-form-in-one-template-on-fosuserbundle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!