问题
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