Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
Camber
New Member
New Member


Joined: Apr 02, 2006
Posts: 13

PostPosted: Thu Sep 06, 2007 12:25 pm Reply with quote

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) : ''));}
 
View user's profile Send private message
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9456
Location: Arizona

PostPosted: Fri Sep 07, 2007 6:44 am Reply with quote

I see that you posted the same question over at Only registered users can see links on this board! Get registered or login! Since kguske has picked up this tool, I am sure that he can help you. Wink

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
Camber
PostPosted: Fri Sep 07, 2007 2:25 pm Reply with quote

Thank you montego. kguske seems a little busy at the moment so if you have an insights I'm all eyes. Thank you!
 
montego
PostPosted: Fri Sep 07, 2007 6:56 pm Reply with quote

Unfortunately just as busy. However, if you can have the luxury of being patient, I am positive that kguske will eventually get there.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

View next topic
View previous topic
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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©