Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

Forums / Cotonti / Support / Pagination Increments

Changing the default pagination intervals in articles section.

Elgan
#12783 2009-05-23 08:58
i would start by making a global plugin or create a new function or edit the old sed_pagination

but if u want to create a new, make a function named sed_pagination_custom

like so

function pagination_custom($url, $current, $entries, $perpage, $characters = 'd', $onclick = '', $object='')
{
	if($entries <= $perpage)
	{
		return '';
	}
	$each_side = 3; // Links each side
	$address = strstr($url, '?') ? $url . '&amp;'.$characters.'=' : $url . '?'.$characters.'=';

	$totalpages = ceil($entries / $perpage);
	$currentpage = floor($current / $perpage) + 1;
	$cur_left = $currentpage - $each_side;
	if($cur_left < 1) $cur_left = 1;
	$cur_right = $currentpage + $each_side;
	if($cur_right > $totalpages) $cur_right = $totalpages;

	$before = '';
	$pages = '';
	$after = '';
	$i = 1;
	$n = 0;
	while($i < $cur_left)
	{
		$k = ($i - 1) * $perpage;
		$listparam = empty($object) ? '' : 'var list = {data: \'&'.$characters.'='.$k.'\', '.$object.'}; ';
		$strlistparam = empty($object) ? $k : 'list';
		$event = empty($onclick) ? '' : ' onclick="'.$listparam.'return '.$onclick.'('.$strlistparam.');"';
		$before .= '<span class="pagenav_pages"><a href="'.$address.$k.'"'.$event.'>'.$i.'</a></span>';
		$i *= ($n % 2) ? 2 : 5;
		$n++;
	}
	for($j = $cur_left; $j <= $cur_right; $j++)
	{
		$k = ($j - 1) * $perpage;
		$class = $j == $currentpage ? 'current' : 'pages';
		$listparam = empty($object) ? '' : 'var list = {data: \'&'.$characters.'='.$k.'\', '.$object.'}; ';
		$strlistparam = empty($object) ? $k : 'list';
		$event = empty($onclick) ? '' : ' onclick="'.$listparam.'return '.$onclick.'('.$strlistparam.');"';
		$pages .= '<span class="pagenav_'.$class.'"><a href="'.$address.$k.'"'.$event.'>'.$j.'</a></span>';
	}
	while($i <= $cur_right)
	{
		$i *= ($n % 2) ? 2 : 5;
		$n++;
	}
	while($i < $totalpages)
	{
		$k = ($i - 1) * $perpage;
		$listparam = empty($object) ? '' : 'var list = {data: \'&'.$characters.'='.$k.'\', '.$object.'}; ';
		$strlistparam = empty($object) ? $k : 'list';
		$event = empty($onclick) ? '' : ' onclick="'.$listparam.'return '.$onclick.'('.$strlistparam.');"';
		$after .= '<span class="pagenav_pages"><a href="'.$address.$k.'"'.$event.'>'.$i.'</a></span>';
		$i *= ($n % 2) ? 5 : 2;
		$n++;
	}
	$pages = $before . $pages . $after;

	return $pages;
}


then play with these lines,

$i *= ($n % 2) ? 2 : 5;

and edit them to how you want it. just at aglance, id start there. or are u looking for more direct help?