0

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)

2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.