In the index.php of msearch the function that renders up page numbers for the search results has an error. When a search returns more than 5 pages of results it should show something like 1 2 3 4 5...20 and when a user clicks on 5 it should look like 1...3 4 5 6...20 and so on. Instead clicking on 5 renders 2 3 4 5. Does anyone have any ideas how to make this function properly? Here is the current code for this section:
Code:
function showpage($start, $len, $fullen, $func, $pfunc){
// Display a list of items on a page, using $func to format these
// items, and $pfunc to show the links to new pages
global $db;
function pagenum($ar){
$c = '';
if (is_array($ar)){
foreach($ar as $val){
$c .= $val.' ';}}
return $c;}
$lastpage = 1;
if ($len > 0){
for ($x = $start + $len, $i = $start;$i < $x;$i++){
$content .= $func($i);}
$page = ($start / $len);
$pagest = ceil(($fullen / $len));
if ($page < 2){
$page = 2;
} else if ($page > $pagest - 3){
$page = $pagest -2;
if ($pagest == 3){
$page = 2;}}
$pages = array();
if ( $fullen > $len){
for ($x = $fullen / $len, $i = 0;$i < $x;$i++){
$pages[] = (round($start/$len) != $i ? $pfunc($i*$len, $len) : '<b>'.($i+1).'</b>');}
$x = 5;
if ($pagest < 5){
$x = $pagest;}
for ($i = 0;$i < $x;$i++){
$pages2[] = $pages[(($page - 2)+$i)];
$lastpage = $i;}}}
$startlen = ($len ? $start/$len : 0);
return array($content, (round($startlen) > 2 && $pagest > 5 ? $pfunc(0, $len).' '._MSELIPSES.' ' : '').pagenum($pages2).(round($startlen) < $pagest-2 && $pagest > 5 ? ' ... '.$pfunc(($pagest-1)*$len, $len) : ''));}
Sorry! I misunderstood your question. I see what you mean. You really can't see more than 5 pages of results, even though the code suggests that it's possible.
I'm working on the nukeFEED release now, so it may be a little while before I can look into this.
Thank you for the reply! From the coding it appears that pages are meant to be rendered for the entire search result with a sliding list of page numbers. For example a query returning 10 pages of results with the user selecting page five should see something like this:
...2 3 4 5 6...10
When page six is selected it should then look like this:
...3 4 5 6 7...10
and so forth.
The elipses are indicated by _MSELIPSES in line 196 of the index.php. There seems to be a logical or variable error in calculating pages over 5. Currently when a search results in more than five pages slecting page 5 renders:
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum