Remove empty pageNavLinkGroup div from html

Luxus

Well-known member
The pageNavLinkGroup container in forum view contains the pagination (for guests and registered members) and the pagination plus the SelectionCountContainer (for mods and admins). An empty pageNavLinkGroup container takes up 20px of space because there is margin applied to it. In the forum_view template I tried to get rid of the empty pageNavLinkGroup container with this code:

Rich (BB code):
<xen:if hascontent="true">
<div class="pageNavLinkGroup">
<xen:contentcheck>
    <div class="linkGroup SelectionCountContainer">
        <xen:comment><xen:include template="forum_view_legacy_controls" /></xen:comment>
    </div>

    <xen:pagenav link="forums" linkdata="{$forum}" linkparams="{$pageNavParams}" page="{$page}" perpage="{$threadsPerPage}" total="{$totalThreads}" />
</xen:contentcheck>
</div>
</xen:if>

The red code is the code I added. Unfortunately it doesn't work. Odd is that this exact code works on other pages with pageNavLinkGroup containers. I think it's caused by the linkGroup SelectionCountContainer div because if I delete it then the code works. Any ideas?
 
Your xen:contentcheck has static HTML in it, so it will always be true. This should work:

Rich (BB code):
<xen:if hascontent="true">
<div class="pageNavLinkGroup">
    <div class="linkGroup SelectionCountContainer">
        <xen:comment><xen:include template="forum_view_legacy_controls" /></xen:comment>
    </div>
<xen:contentcheck>
    <xen:pagenav link="forums" linkdata="{$forum}" linkparams="{$pageNavParams}" page="{$page}" perpage="{$threadsPerPage}" total="{$totalThreads}" />
</xen:contentcheck>
</div>
</xen:if>
 
Thanks, but there's one problem with this code. It also removes the pageNavLinkGroup container for mods and admins. For them it isn't empty. It contains this:

pagenav.webp

I only want to remove empty containers from the html.
 

Similar threads

Back
Top Bottom