• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 Annoying thread_list_item behavior

#1
This is user reported, but I have to agree.

It's starting to bug me that a thread that has five pages of comments will have direct links to all but the second page of comments.​

As far as I can tell by code, this has to do with a combination of $thread.lastPageNumbers and an apparently do-nothing ellipsis in the thread_list_item template.

Code:
<xen:if is="{$showLastPageNumbers} AND {$thread.lastPageNumbers}">
   <span class="itemPageNav">
     <span>...</span>
     <xen:foreach loop="$thread.lastPageNumbers" value="$pageNumber">
       <a href="{xen:link threads, $thread, 'page={$pageNumber}'}">{$pageNumber}</a>
     </xen:foreach>
   </span>
</xen:if>

The ellipsis - which really should be U+2026 - is shown if pages are skipped or not. I'm sure hiding the ellipsis in certain contexts would be the better behavior, but what contexts I'm not sure of.
 
Last edited:
#5
It shows the last three pages, but not page 1, because that would be a redundant link. That part's fine.

But using an ellipsis implies something has been skipped.

1 page thread, no links
2 page thread, nothing skipped but has an ellipsis
3 page thread, nothing skipped but has an ellipsis
4 page thread, nothing skipped but has an ellipsis
5 page thread, page 2 is skipped, elipsis takes up as much room as the link would have
6+ page thread, ellipsis makes sense.

It's a grammatically strict nitpick, but nothing that hasn't come up in other contexts.
 

Brogan

XenForo moderator
Staff member
#6
If it bothers you, you can wrap the ellipsis span in a conditional statement to only show if there are more than x pages.
 
#7
Thanks, Brogan, I did some research and have done just that. Here it is for anyone that may care:

Code:
<xen:if is="{$showLastPageNumbers} AND {$thread.lastPageNumbers}">
   <span class="itemPageNav">
     <xen:if is="{$thread.lastPageNumbers.0} == 3">
       <a href="{xen:link threads, $thread, 'page=2'}">2</a>
     </xen:if>
     <xen:if is="{$thread.lastPageNumbers.0} >= 4">
       <span>…</span>
     </xen:if>
     <xen:foreach loop="$thread.lastPageNumbers" value="$pageNumber">
       <a href="{xen:link threads, $thread, 'page={$pageNumber}'}">{$pageNumber}</a>
     </xen:foreach>
   </span>
</xen:if>