简体   繁体   中英

How to change template of controller rendered in twig file (Symfony 3)?

I know that we can render the content of a controller in twig file like this:

{{ render(controller('FOSUserBundle:Security:login',{"baseTemplate": true})) }}

However, I don't know if we can pass the new template so that the controller will use it instead of the default. Anyone tried to override template in this way?

I don't really understand the issue here

If you do

{{ render(controller('FOSUserBundle:Security:login',{"baseTemplate": true})) }}

You could aswell do:

{{ render(controller('FOSUserBundle:Security:login',{"template": "your_template.html.twig"})) }}

Or

{{ render(controller('FOSUserBundle:Security:login',{"templateNumber": "4"})) }}

Where templateNumber is used in a condition inside your controller ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM