Answer the question
In order to leave comments, you need to log in
How to print twig array?
Hi all!
There is a cycle
{% for category in categories %}
<li class="header-main-menu__item">
<a class="header-main-menu__link header-main-menu__item_font " href="{{ category.href }}">{{ category.name }}</a>
</li>
{% endfor %}
Answer the question
In order to leave comments, you need to log in
If you look at the documentation , you can find a wonderful function {{ dump(user) }}
, it is a wrapper for php var_dump . To make it work, you need to enable debug mode for Twig.
$twig = new Twig_Environment($loader, array(
'debug' => true,
// ...
));
$twig->addExtension(new Twig_Extension_Debug());
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question