Answer the question
In order to leave comments, you need to log in
How to implement a block structure project in Symfony?
I recently started studying Symfony 2, maybe I didn’t understand something fundamentally, please help me in solving the problem: It is
necessary to implement modular project loading, i.e. menu, authorization form, news feed, list of users and other blocks on the site. As far as I understand, it is necessary to define the router and write the appropriate handler in the controller, it will give out data for the twig template, which will be displayed to the user. But it's not clear to me how to combine different functional blocks with different templates and different routers into one lauout in order to collect them all.
I know it's possible to "inherit" twig templates, but if I define my template as a piece of the base layuot, when I call the router for that template, how will other templates be loaded if my controller only returns data for my template? I need to separate the blocks from each other as much as possible so that they do not depend on others.
Now I need to integrate the login form from FOSUserBundle with other blocks of the site, I created a child bundle from FOSUserBundle, but I don’t know where to go next. I found the SonataBlock bundle but I can’t figure out if it is needed at all in this case or not. Please help those who are strong in this.
Answer the question
In order to leave comments, you need to log in
Twig has a function render
for exactly this need
Example:
{% render 'AcmeDemoBundle:User:login' %}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question