<p>Anything that is defined in <code>index.twig</code> outside of a <code>block</code> will be available in <code>skeleton.twig</code>, and so also in <code>template.twig</code>. This should work:</p>

<p><strong>skeleton.twig</strong></p>

<pre><code>{% include '_includes/template' %}
</code></pre>

<p><strong>index.twig</strong></p>

<pre><code>{% extends "skeleton" %}

{# Set parameter #}
{% set param = {
    section: ['handle1', 'handle2']
} %}
</code></pre>

CC BY-SA 3.0
2015-04-12T07:36:00.950Z
2015-04-12T07:36:00.950Z
Marion Newlevant
<p>I have this situation, where variable <code>param</code> doesn't exist.</p>

<p><strong>skeleton.twig</strong></p>

<pre><code>{# Inject template #}
{% block var %}{% endblock %} 
{% include '_includes/template' %}
</code></pre>

<p>Now I want to extends <strong>index.twig</strong> with skeleton.twig and output all rendered data.</p>

<pre><code>{% extends "skeleton" %}

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

<p><strong>template.twig</strong></p>

<pre><code>{% paginate craft.entries(param) as entriesOnPage %}
    {# data #}
{% endpaginate %}
</code></pre>

<p>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 <code>{% include '_includes/components/feed/feed' %}</code>.</p>

<p>Otherwise I have no idea, except I put wrong <code>craft.entries(param)</code></p>

<include><blocks>
Passing variable from block within including template
# Passing variable from block within including template

(Asked by: username_0 on 2015-04-11)

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)

**Tags:** include, blocks


---

## 1 answers

### Answer by username_1 on 2015-04-12. Score: 2 | Accepted answer

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']
} %}


---

