Page 1 of 1

pagination function does not work in listcontent.php

Posted: Thu Jun 22, 2006 5:58 am
by nafas
hi.i'm using cmsmadesimple-0.13beta4 with PHP Version 4.3.10 and apache 2.0.43 as httpserver.
i edit 'Number of Content Items to show per/page in Page List' in userpreference(editprefs.php) to '10'.now the problem is when i have more than 10 content in my content list,all of them will be shown in just one page.but pagination function in other pages work!

the code in listcontent.php is like this:

Code: Select all

if ($limit != 0 && $counter > $limit)
{
	$thelist .= "<p>".pagination($page, $counter, $limit)."</p>";
}
while $counter is always equal to one(even if i have no content in the list!)

but count($pagelist) shows the number of contents + 1.(i mean when i have 12 content in my list,it returns 13).
so i replace

Code: Select all

if ($limit != 0 && $counter > $limit)
{
	$thelist .= "<p>".pagination($page, $counter, $limit)."</p>";
}
with

Code: Select all

if ($limit != 0 && count($pagelist) > $limit)
{
	$thelist .= "<p>".pagination($page, count($pagelist), $limit)."</p>";
}
.now the links for next and prev. pages appear, but each page shows all of the contents!(i have 13 contents,and so 2 pages.but listcontent.php?page=1 and listcontent.php?page=2 shows all contents)

Re: pagination function does not work in listcontent.php

Posted: Sat Jun 24, 2006 6:34 am
by nafas
as i said when i changed the code to

Code: Select all

if ($limit != 0 && count($pagelist) > $limit)
{
$thelist .= "<p>".pagination($page, count($pagelist), $limit)."</p>";
}
the links for preveious and next page will apear(i mean 'previous 1 2 next' is apeared at the top of page.)so it means that the parameters that has been sent to pagination function is true. but why the list does not generate according to these pagination?

Re: pagination function does not work in listcontent.php

Posted: Sun Jun 25, 2006 10:33 am
by nafise
i had the same problem too!in addition to those changes that you had made, you should repolace

Code: Select all

if ($hierarchy->hasChildren())
{
	display_hierarchy($hierarchy);
	foreach ($pagelist as $item)
	{
		$thelist.=$item;
	}
	$thelist .= '</tbody>';
	$thelist .= "</table>\n";
}
with

Code: Select all

if ($hierarchy->hasChildren())
{
	display_hierarchy($hierarchy);
	$i=0;
	foreach ($pagelist as $item)
	{
        if(($i==0 || ((($page-1)*$limit)<$i and $i<(($page*$limit)+1))) || $limit == 0) 
        // $limit == 0 it means that you dont want to set any limit
		    $thelist.=$item;
		$i++;
	}
	$thelist .= '</tbody>';
	$thelist .= "</table>\n";
}
.