Page 1 of 1

News module pageNumber / pageCount problem

Posted: Fri Jul 27, 2007 4:01 pm
by excidium
Hi,

i'm new to cmsmadesimple and found a strange 'error', i would not report it as a bug, so i'm posting it here.
Don't know if anyone else had the problem, but the message buttons of the next / prev pages are not working properly. In the default Summary Template it's code is displayed as follows:

Code: Select all

<!-- Start News Display Template -->
{if $pagecount > 1}
  <p>
{if $pagenumber > 1}
{$firstpage} {$prevpage} 
{/if}
{$pagetext} {$pagenumber} {$oftext} {$pagecount}
{if $pagenumber < $pagecount}
 {$nextpage} {$lastpage}
{/if}
</p>
I my case it showed a 'next' option, when there was no item in the next page.
Found the error in the following file: modules/News/action.default.php, line:158/159:
change:

Code: Select all

$pagecount = intval($row2['count'] / $pagelimit);
if( ($pagecount % $pagelimit) != 0 ) $pagecount++;
to:

Code: Select all

$pagecount = ceil($row2['count'] / $pagelimit);
Hope someone can use this,
Greetings Excidium