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

XF 1.2 Is possible to always show thread page number 1 for multi-paged threads on thread list

Discussion in 'Styling and Customization Questions' started by maxicep, Oct 21, 2013.

  1. maxicep

    maxicep Active Member

    Hello

    If the thread have many page, then thread pagination shows only the last 3 page number as u know. But i want the show page number 1 for click & go the first page and first post of thread .

    I know if there are no new post the thread, thread link will redirect to first page and first post already but watching threads redirecting to first unread post if have new posts in thread.

    So, can i add the page number "1" to pagination system if total page number > 3 or add the "go to first post link or icon" in thread_list?

    Thank you
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    upload_2013-10-21_9-14-15.png

    Like this?


    It's a simple template edit.

    Find the template thread_list_item and search for and add the code in red:

    Code:
                        <xen:if is="{$showLastPageNumbers} AND {$thread.lastPageNumbers}">
                            <span class="itemPageNav">
                                <a href="{xen:link threads, $thread}">1</a>
                                <span>...</span>
                                <xen:foreach loop="$thread.lastPageNumbers" value="$pageNumber">
                                    <a href="{xen:link threads, $thread, 'page={$pageNumber}'}">{$pageNumber}</a>
                                </xen:foreach>
                            </span>
                        </xen:if>
    You may also want to do a similar change to conversation_list_item.

    It's worth noting, however, that if you click the date, that does take you to the first post in the thread.
     
  3. maxicep

    maxicep Active Member

    Thank you, its working
    I applied to conversion list too

    But if thread have 2 page, then it looking like:

    1-2page.PNG

    I think, page number 1 must be show only if total page >= 3
     
  4. Chris D

    Chris D XenForo Developer Staff Member

    I've done something a bit different.

    If you only show page number 1 when the total pages is above 3, it means if there are two pages, you still don't see the first number. So the solution is actually to show/hide the "..." based on the number of pages:

    Code:
                        <xen:if is="{$showLastPageNumbers} AND {$thread.lastPageNumbers}">
                            <span class="itemPageNav">
                                <a href="{xen:link threads, $thread}">1</a>
                                <xen:if is="{xen:count $thread.lastPageNumbers} >= 3 AND {$thread.lastPageNumbers.0} != 2">
                                    <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>
    
    That produces:

    upload_2013-10-21_9-47-57.png

    Or:

    upload_2013-10-21_9-50-26.png

    Or:

    upload_2013-10-21_9-48-36.png

    So if there are 3 ore more last page numbers, and the first of those isn't page 2, then show the ellipsis.
     
  5. maxicep

    maxicep Active Member

    Thank you so much, it is now completed :)

    Also, is may apply the conversion_list_item too ? Same code ?
     
  6. Chris D

    Chris D XenForo Developer Staff Member

    Almost the same code. I haven't looked at the conversation code. I'm guessing it's just a case of being the same code but "thread" becomes "conversation".
     

Share This Page