问题描述
我正在使用Symfony应用程序中的FosuserBundle, 我在单独的模板中有登录名并注册表单.我希望两个模板都在一个模板中显示它们.
plz帮助我节省我的一天!
推荐答案
1 您需要拥有一个带有loginAction login.html.twig模板的第一个控制器.让我们假设此控制器是AcmeUserBundle:Security:login.
2 您需要拥有一个带有registerAction的控制器,该控制器构成register.html.twig模板.让我们假设此控制器是AcmeUserBundle:Registration:register
3 创建第三个控制器,例如welcomeAction呈现welcome.html.twig模板,然后将控制器嵌入上面的同一页面.
{# AcmeUserBundle:Welcome:welcome.html.twig #} {{ render(controller('AcmeUserBundle:Security:login'})) }} {{ render(controller('AcmeUserBundle:Registration:register'})) }}
参见在这里有关如何如何了解如何的信息嵌入控制器.
问题描述
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 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.