Counting Results

argy

Member
Hello.
In XF1 you could see how many results were shown if i use the search.
For example if i am using the search i will get my results and under my results is written: "Showing results 1 to 6 of 6".
Or if i am going into a forum i will see: "Showing threads 1 to 16 of 16".

Is it possible to get this in XF2 again?
 
In search_result template find:
HTML:
        <xf:if is="{$getOlderResultsDate}">
            <div class="block-footer">
                <span class="block-footer-controls"><xf:button href="{{ link('search/older', $search, {'before': $getOlderResultsDate}) }}" class="button--link">
                    {{ phrase('view_older_results') }}
                </xf:button></span>
            </div>
        </xf:if>
Replace with this:
HTML:
        <div class="block-footer">
            <xf:set var="$resultStartOffset" value="{{ ($page - 1) * $perPage + 1 }}" />
            <xf:set var="$resultEndOffset" value="{{ ($page - 1) * $perPage + count($results) }}" />
            <span class="block-footer-counter">Showing results {$resultStartOffset} to {$resultEndOffset} of {$search.result_count}</span>
            <xf:if is="{$getOlderResultsDate}">
                <span class="block-footer-controls"><xf:button href="{{ link('search/older', $search, {'before': $getOlderResultsDate}) }}" class="button--link">
                    {{ phrase('view_older_results') }}
                </xf:button></span>
            </xf:if>
        </div>

1536690465880.webp
 
Top Bottom