ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

PHP Error using Pagination in EE 2.3.1

November 02, 2011 4:31pm

Subscribe [2]
  • #1 / Nov 02, 2011 4:31pm

    glenndavisgroup

    436 posts

    I’m running into an issue with Pagination when trying to display comment entries. It seems as though it’s failing if limit parameter value is more than the number of comments posted when using pagination. I have my tag setup like so:

    {exp:comment:entries channel="news" limit="10" orderby="comment_date" sort="desc" dynamic="yes" paginate="bottom"}
    
    //Some html code here…
    
     {paginate}
     <div id="paginateContainer">
      {pagination_links}
         <ul class="pagination">
             {first_page}
             <li><a href="http://{pagination_url}#comments">First</a></li>
             {/first_page}
     
             {previous_page}
             <li><a href="http://{pagination_url}#comments">Previous</a></li>
             {/previous_page}
     
             {page}
             <li class="pageNum">{if current_page}{pagination_page_number}{if:else}<a href="http://{pagination_url}#comments">{pagination_page_number}</a>{/if}</li>
             {/page}
     
             {next_page}
             <li><a href="http://{pagination_url}#comments">Next</a></li>
             {/next_page}
     
             {last_page}
             <li><a href="http://{pagination_url}#comments">Last</a></li>
             {/last_page}
         </ul>
      {/pagination_links} 
     </div>
     {/paginate}
     {if no_results}
     <div id="newsViewCommentSaperatorOff">
      <div id="newsViewCommentImg"> </div>
      <div>Be the first to comment on this news item.</div>
     </div>
     {/if}
     <div class="newsViewCommentCleaner"></div>
    {/exp:comment:entries}

    This doesn’t work if I only have 1 comment. I get the following error on the page:

    A PHP Error was encountered
    Severity: Notice
    Message: Array to string conversion
    Filename: libraries/Template.php
    Line Number: 3726

    If I remove the pagination code from the above everything works with no errors. But as soon as I put it back the error is back.

    One thing I noticed is if I have lets say 11 comments added to the above channel then the pagination works. It seems as though I have to have more comments than what the limit parameter value is set for the pagination to work without errors.

    I tested with a few different limit parameter values and that’s exactly what’s happening. As soon as I enter more comments than what’s set in the limit parameter value everything works. Has anyone seen this before and is there a fix for it? Any help is appreciated.

    Thank you,

    Mike

  • #2 / Nov 03, 2011 9:16am

    glenndavisgroup

    436 posts

    I ran some more tests and it’s working fine for channel entries but not comment entries. Can anyone else verify this for me please?

    Thank you,

    Mike

  • #3 / Nov 03, 2011 11:21am

    glenndavisgroup

    436 posts

    Can anyone help with this please?

  • #4 / Nov 03, 2011 4:27pm

    Sue Crocker

    26054 posts

    I’m able to replicate the problem on EE2.3.1 using the scenario you specified. I filed a bug report on your behalf. You may want to comment on that bug report so you’ll receive a notification when the status changes.

  • #5 / Nov 03, 2011 5:05pm

    glenndavisgroup

    436 posts

    Thanks Sue. I thought I was going crazy or missed something.

    Mike

  • #6 / Nov 03, 2011 8:57pm

    Sue Crocker

    26054 posts

    It took me a while to replicate it, but I can.. hopefully it’ll get fixed soon. Feel free to start a new thread if you have any more questions.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases