[Home]WikiPatches/SearchResultsLimit

UseModWiki | WikiPatches | RecentChanges | Preferences

Add $PageCountLimit to the config file, like:

$PageCountLimit = 70; # Number or returns per page when doing a search/index

And add it to the Configuration constant variables. Then modify the PrintPageList sub as below:

sub PrintPageList {
  my ($pagename, $spacer, $pagecount, $printcount, $pagenumber, $next, $action, $keywordcache, $back, $dosearch);
  $next = &GetParam("next","0");
  $action = &GetParam("action","");
  $keywordcache = &GetParam("search","");
  $dosearch = &GetParam("dosearch","");
  $back = &GetParam("back","");
  $pagecount = @_;
  print "<p>The ", Ts('query you performed returned %s pages', ($#_ + 1)), ". The limit per page is $PageCountLimit.</p>\n";
  foreach $pagename (@_) {
    $pagenumber++;
    if ($pagenumber >= "$next") {
      if ($pagename =~ m|/|) {
          $spacer = "\&nbsp\;\&nbsp\;\|\=\> ";
      }
      else { $spacer = ""; }
      $printcount++;
      print "<ul><li>" . $spacer . &GetPageLink($pagename) . "</ul>";
      if ($printcount >= $PageCountLimit) { last; }
    }
  # } # I think that it's extra --JuanmaMP
  if ($action eq "index" || ($dosearch eq "1" && $keywordcache eq "")) {
    if ($action eq "") { $action = "index"; }                                                                                                       
    print "<center><p>";
    unless ($next == "0") { print "<< <a href=\"javascript:history.go(-1)\">Back</a>"; }
    if ($pagenumber < $pagecount) {
      unless ($next == "0") { print " | "; }
      print "<a href=\"$ScriptName?action=$action&next=".($pagenumber+1)."\">Next</a> >>";
    }
    print "</p></center>";
  }
  elsif ($back ne "") {
    print "<center><p>";
    unless ($next == "0") { print "<< <a href=\"javascript:history.go(-1)\">Back</a>"; }
    if ($pagenumber < $pagecount) {
      unless ($next == "0") { print " | "; }
      print "<a href=\"$ScriptName?back=$back&next=".($pagenumber+1)."\">Next</a> >>";                                                                 
    }
    print "</p></center>";  
  }
  else {
    print "<center><p>";  
      $printcount++;
      print "<ul><li>" . $spacer . &GetPageLink($pagename) . "</ul>";
      if ($printcount >= $PageCountLimit) { last; }
    }
  }
  if ($action eq "index" || ($dosearch eq "1" && $keywordcache eq "")) {
    if ($action eq "") { $action = "index"; }                                                                                                       
    print "<center><p>";
    unless ($next == "0") { print "<< <a href=\"javascript:history.go(-1)\">Back</a>"; }
    if ($pagenumber < $pagecount) {
      unless ($next == "0") { print " | "; }
      print "<a href=\"$ScriptName?action=$action&next=".($pagenumber+1)."\">Next</a> >>";
    }
    print "</p></center>";
  }
  elsif ($back ne "") {
    print "<center><p>";
    unless ($next == "0") { print "<< <a href=\"javascript:history.go(-1)\">Back</a>"; }
    if ($pagenumber < $pagecount) {
      unless ($next == "0") { print " | "; }
      print "<a href=\"$ScriptName?back=$back&next=".($pagenumber+1)."\">Next</a> >>";                                                                 
    }
    print "</p></center>";  
  }
  else {
    print "<center><p>";  
    unless ($next == "0") { print "<< <a href=\"javascript:history.go(-1)\">Back</a>"; }
    if ($pagenumber < $pagecount) {
      unless ($next == "0") { print " | "; }                                                                                                 
      print "<a href=\"$ScriptName?search=$keywordcache&next=".($pagenumber+1)."\">Next</a> >>";
    }
    print "</p></center>";
  }
}

This modifications were written by GerardoBetancourt. I am sorry it is not written as a patch. I may come later, do a diff and post the patch lines instead. -- DavidCollantes


UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited June 26, 2012 4:26 pm by JuanmaMP (diff)
Search: