F
F
fman22016-07-03 19:12:31
symfony
fman2, 2016-07-03 19:12:31

How to add variable to base layout in Symfony2?

Good day!
The Symfony documentation is only in English, I'm studying the second day and my head hurts honestly. But not about that now...
There is a block of code, let's call it a menu, which is the same on all pages, how to place it correctly in base.html.twig if the data is taken from the database and how to set up getting this data in one place?
Roughly speaking, I would like to write in the template like this:
<?php $items = $menu->getItems(); ?>
Before that, I dealt with Yii2, everything is much simpler in this regard.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2016-07-03
@fman2

There is a block of code, let's call it menu, which is the same on all pages

https://symfony.com/doc/current/book/templating.ht...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question