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: 3726If 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