Changing the default pagination intervals in articles section.
aro747 |
|
---|---|
Hi there,
How can I change the current pagination increments in the articles section from 5, 10, 15, etc. to 4, 8, 12, 16... thanks, aro |
Elgan |
|
---|---|
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 . '&'.$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? |
aro747 |
|
---|---|
Thanks. It seems a bit complicated for me. I was hoping I could just change whatever file is necessary to get this done. Is that possible? I have a very simple site setup so it should be ok to do a core hack. Thanks for your help.
|
Trustmaster |
|
---|---|
As Elgan noticed
$i *= ($n % 2) ? 2 : 5;
It sets multipliers for numbers. If you replace it with, e.g. $i *= ($n % 2) ? 4 : 3;
May the Source be with you!
|
pieter |
|
---|---|
you can also use sedplus.
... can we help you ...
|
aro747 |
|
---|---|
Trustmaster, thanks for your help. Sorry, my post may have been confusing. I'm trying to change the "Maximum lines in lists". Right now in the drop down the options are 5, 10, 15, 20... I want to change that to 4, 8, 12, 16... Sorry for the confusion.
thanks, aro Actually I figured this out now. In "functions.admin.php" you can change the "maxrowsperpage" to your liking. Thanks for your help everyone. |
|
This post was edited by aro747 (2009-05-24 00:34, 15 years ago) |