Answer the question
In order to leave comments, you need to log in
How to make 1 insert for all templates in Twig?
Trying to figure out with Twig
;
Let's say base.html has {% block menu %}{% endblock %}
Take the index.html template which is {% extends "base.html" %}
This is where we pass $rsCategories to the index.html template
function indexAction($twig){
$rsCategories = getAllCatsWithChildren();
$template = loadTemplate($twig, 'index.html');
echo $template->render(array(
'rsCategories' => $rsCategories));}
{% block menu %}
{% for categorie in rsCategories %} < вывод категорий> {% endfor %}
{% endblock %}
$rsCategories = getAllCatsWithChildren();
rsCategories' => $rsCategories
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question