Use paginate info in another block I'm trying to get my head around the following issue. I have a site which uses a base layout template base.twig, on which 3 layout templates are build (using extends). One of them is main.twig.

I want to use the paginate information variable pageInfo (see docs) in a block that's defined in the base template, to show the total number of entries found in the {% block pageTitle %}{% endblock %}. I tried a number of things, including defining a pageTitle variable in the base.twig template, to override in the content block, but all without any luck.

These are stripped down versions of my files:

_layouts/base.twig

&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt;{{ title }}&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
        {% block header %}{% endblock %}
        &lt;main&gt;
            {% block pageTitle %}{% endblock %}
            {% block main %}{% endblock %}
        &lt;/main&gt;
        {% block footer %}{% endblock %}
    &lt;/body&gt;
&lt;/html&gt;


_layouts/main.twig

{% extends "_layouts/base" %}

{% block main %}
    &lt;div class="main"&gt;
        {% block content %}{% endblock %}
    &lt;/div&gt;
{% endblock %}


posts/index.twig

{% extends "_layouts/main" %}
{% set title = 'My posts listing' %}

{% set entries = craft.entries... %}

{% block content %}
    {% paginate entries as pageInfo, pageEntries %}
        &lt;section&gt;
            {% for entry in pageEntries %}
                &lt;article&gt;
                    &lt;h2&gt;{{ entry.title }}
                &lt;/article&gt;
            {% endfor %}
        &lt;/section&gt;

        {% block pageTitle %}
            &lt;h1&gt;{{ pageInfo.total }} entries found&lt;/h1&gt;
        {% endblock %}

    {% endpaginate %}
{% endblock %}


I know this has to do with variable scopes, but how can I use the paginate information outside my content block? One solution I tried does indeed works, but do I really need to copy the {% paginate %} statement inside my pageTitle block to get this working? That seems to be very inefficient to me:

posts/index.twig

{% extends "_layouts/main" %}
{% set title = 'My posts listing' %}

{% set entries = craft.entries... %}

{% block content %}
    {% paginate entries as pageInfo, pageEntries %}
        &lt;section&gt;
            {% for entry in pageEntries %}
                &lt;article&gt;
                    &lt;h2&gt;{{ entry.title }}&lt;/h2&gt;
                &lt;/article&gt;
            {% endfor %}
        &lt;/section&gt;
    {% endpaginate %}
{% endblock %}

{% block pageTitle %}
    {% paginate entries as pageInfo, pageEntries %}
        &lt;h1&gt;{{ pageInfo.total }} entries found&lt;/h1&gt;
    {% endpaginate %}
{% endblock %}


Hope you can help me out or point me in the right direction. Any tips regarding a better structure for the blocks are also welcome. Twig seems so popular, so you'd think it can't be that hard for such simple tasks? Maybe I'm using the whole block concept totally wrong in the first place.
As of Craft 2.5.2750, you can leave off the {% endpaginate %} tag, then move your {% paginate %} tag up outside of the blocks in the posts/index.twig template, and your pageInfo variable should be available to the whole template, including the parent template that you're extending.