XF 2.0 Always show pagenav?

Ivar Hill

Member
For layout reasons I'd like to always show the pagenav element on threads/conversations, even when there's just one page (there'd just be a single button saying "1". However, I can't seem to modify this call:

<xf:pagenav page="{$page}" perpage="{$perPage}" total="{{ $thread.reply_count + 1 }}" link="threads" data="{$thread}" wrapperclass="block-outer-main" />

To display even when there's no threads. Could someone perhaps give me a nudge in the right direction? Thanks :)
 
Ivar, I was trying to accomplish the same thing. Not sure if there is a way around this but I resorted to hacking the php code to force it to display pagination:

/public/forums/src/XF/Template/Templater.php
Code:
// replace perPage with 0 to display pagination when 1 page
//      if ($total <= $perPage)
// don't show paginaiton awhen total <= 0 (e.g. no search results found, no bookmarks, etc.)
        if ($total <= 0)
        {
            return '';
        }

And in template page_nav I inserted the following lnes between the nav tag:
Code:
<nav class="pageNavWrapper pageNavWrapper--{{ property('pageNavStyle') }} {$variantClass}">
<xf:if is="$totalPages == 1">
    <a href="" class="pageNavSimple-el pageNav-page">
        {{ phrase('x_of_y', {'current': $current, 'total': $totalPages}) }}
    </a>
<xf:else />
.
.
.
</xf:if>
</nav>
 
Last edited:
Back
Top Bottom