solved Page Next Issue

Dazed
Dazed
@dazed
7 years ago
1,022 posts
I have a page with a menu for site news, site comments, premium blogs located here - https://www.mixposure.com/community that loads when clicked.

My issue is that the site comments page next is not working. It is not even displayed so the first {if $info.total_pages > 1} kills it immediately. The other two work as expected however they are blogs and this is a comment page. I removed the conditional statement so that I at least get the page back/forward displayed.

Any ideas?

{* ROW TEMPLATE *}
{capture name="row_template" assign="site_comments_template"}
{literal}
{if isset($_items)}
    {foreach from=$_items item="item"}
    
            <div class="block">
                <div style="display:table">
                    <div style="display:table-row;">
                        <div style="display:table-cell;width:1%;text-align:center;vertical-align:top;">
                            <a href="{$jamroom_url}/{$item.profile_url}">{jrCore_module_function function="jrImage_display" module="jrUser" type="user_image" item_id=$item._user_id size="small" crop="auto" alt=$item.user_name class="action_item_user_img iloutline"}</a>
                        </div>
                        
              <div style="display:table-cell;text-align:left;vertical-align:top;padding-left:5px;">
              <div  class="normal">            
                        
		<div style="padding:10px;">
        <div class="br-info" style="margin-bottom:20px;">
            <div class="blog-div">
                <span class="blog-user capital"> Re: <a href="{$item.comment_url}"> {$item.comment_item_title}</a></span>
            </div>
            <div class="blog-div">
                <span class="blog-replies"> By: {$item.user_name} <a href="{$jamroom_url}/{$item.profile_url}">@{$item.profile_name}</a></span>
            </div>
<br><br>
        {$item.comment_text|jrCore_format_string:$item.profile_quota_id}
			
		<br><br>
        </div></div></div></div></div></div></div>
    
    {/foreach}

 
                     {if $info.total_pages > 1}
                    <div class="block">
                        <table style="width:100%;">
                            <tr>

                                <td class="body_5 page" style="width:25%;text-align:center;">
                                    {if isset($info.prev_page) && $info.prev_page > 0}
                                    <a onclick="jrLoad('#site_comments_div','{$jamroom_url}/site_comments/p={$info.prev_page}');"><span class="button-arrow-previous"> </span></a>
                                    {else}
                                    <span class="button-arrow-previous-off"> </span>
                                    {/if}
                                </td>

                                <td class="body_5" style="width:50%;text-align:center;">
                                    {if $info.total_pages <= 5 || $info.total_pages > 500}
                                    {$info.page}  / {$info.total_pages}
                                    {else}
                                    <form name="form" method="post" action="_self">
                                        <select name="pagenum" class="form_select" style="width:60px;" onchange="var sel=this.form.pagenum.options[this.form.pagenum.selectedIndex].value;jrLoad('#site_comments_div','{$jamroom_url}/site_comments/p=' +sel);">
                                        {for $pages=1 to $info.total_pages}
                                            {if $info.page == $pages}
                                                <option value="{$info.this_page}" selected="selected"> {$info.this_page}</option>
                                        {else}
                                        <option value="{$pages}"> {$pages}</option>
                                        {/if}
                                        {/for}
                                        </select> / {$info.total_pages}
                                    </form>
                                    {/if}
                                </td>

                                <td class="body_5 page" style="width:25%;text-align:center;">
                                    {if isset($info.next_page) && $info.next_page > 1}
                                    <a onclick="jrLoad('#site_comments_div','{$jamroom_url}/site_comments/p={$info.next_page}');"><span class="button-arrow-next"> </span></a>
                                    {else}
                                    <span class="button-arrow-next-off"> </span>
                                    {/if}
                                </td>

                            </tr>
                        </table>
                    </div>
                    {/if}
                    {/if}
                {/literal}
            {/capture}
 

{* COMMENT LIST FUNCTION *}
{jrCore_list module="jrComment" order_by="_item_id NUMERICAL_DESC" template=$site_comments_template pagebreak="10"  page=$_post.p}




updated by @dazed: 04/24/17 02:18:05PM
michael
@michael
7 years ago
7,715 posts
This {if $info.total_pages > 1}. reads "If there are more than 1 page".

So its saying: "Only show the page buttons if there are pages to go to"
Dazed
Dazed
@dazed
7 years ago
1,022 posts
agreed but I have like 25k + comments. If I change it to 25 for the pagebreak it would display 25 on the page.
nate
@nate
7 years ago
917 posts
pager=true?
Dazed
Dazed
@dazed
7 years ago
1,022 posts
That added the next page button instead which helped but I lost all formatting on p2. Updated on the site if u want to see it. This now also shows that there are additional pages.
updated by @dazed: 01/18/17 06:46:17PM
Dazed
Dazed
@dazed
7 years ago
1,022 posts
ok added a debug and I am missing total_pages which is odd?

$info}
Array (8)
next_page => 2
pagebreak => 10
simplepagebreak => 10
page => 1
this_page => 1
prev_page => 0
page_base_url => "https://www.mixposure.com/site_comments"
total_items => 10

updated by @dazed: 01/18/17 06:52:00PM
michael
@michael
7 years ago
7,715 posts
looks like simplepagebreak is active. With that you skip the counting function that returns the total number of results. Its speeds up the query but means that you dont get the page number, so dont use the page jumper. Just the next/prev buttons.

--edit--
Bit of info on it here:

Docs: "{jrCore_list} : Performance Tips"
https://www.jamroom.net/the-jamroom-network/documentation/jamroom-developers-guide/89/jrcore-list#performance-tips

Its probably enabled for your system somewhere in the ACP to improve site speed.
updated by @michael: 01/18/17 07:13:32PM
Dazed
Dazed
@dazed
7 years ago
1,022 posts
Thanks all. I will test it out. Odd that it is enabled for the blog items though?
Dazed
Dazed
@dazed
7 years ago
1,022 posts
got it. slight error in the call.

thanks for the help!
Dazed
Dazed
@dazed
7 years ago
1,022 posts
michael:
looks like simplepagebreak is active. With that you skip the counting function that returns the total number of results. Its speeds up the query but means that you dont get the page number, so dont use the page jumper. Just the next/prev buttons.

--edit--
Bit of info on it here:

Docs: "{jrCore_list} : Performance Tips"
https://www.jamroom.net/the-jamroom-network/documentation/jamroom-developers-guide/89/jrcore-list#performance-tips

Its probably enabled for your system somewhere in the ACP to improve site speed.

Just saw the edit Michael. The simplepagebreak makes sense but the Site News and Site Blogs have the jumper. This would mean that simplepagebreak would only be enabled for comments? Could be true just not sure where it would be set hehe. The way it is working now is fine. The jumper for comments is just not needed in my mind.
michael
@michael
7 years ago
7,715 posts
your site is large, I suspect you have settings to make it run better, take a look here:
yoursite.com/core/admin/global/section=DataStore

and see if the 'use optimized pager' setting is set:
Quote: Checking this option will disable the Page Jumper on listing pages when the core determines the resulting SQL COUNT() query would slow down the system.

Leave this option enabled - disabling this on large systems can result in slow page generation.

Or it might be somewhere else. something is turning that on for you, we can pinpoint where if its necessary to track it down.