Passing variable from block within including template I have this situation, where variable param doesn't exist.

skeleton.twig

{# Inject template #}
{% block var %}{% endblock %} 
{% include '_includes/template' %}


Now I want to extends index.twig with skeleton.twig and output all rendered data.

{% extends "skeleton" %}

{% block var %}
    {# Set parameter #}
    {% set param = {
        section: ['handle1', 'handle2']
    } %}
{% endblock %}


template.twig

{% paginate craft.entries(param) as entriesOnPage %}
    {# data #}
{% endpaginate %}


As I go step by step in rendering process, I think, that the reason Why I'm getting this problem is because, the ECM is printed after {% include '_includes/components/feed/feed' %}.

Otherwise I have no idea, except I put wrong craft.entries(param)
Anything that is defined in index.twig outside of a block will be available in skeleton.twig, and so also in template.twig. This should work:

skeleton.twig

{% include '_includes/template' %}


index.twig

{% extends "skeleton" %}

{# Set parameter #}
{% set param = {
    section: ['handle1', 'handle2']
} %}