[Home]SearchBody

UseModWiki | RecentChanges | Preferences

This function is defined but never called.


Interesting... I wanted to search only titles, when clicking on the Header, so I was looking to hack my way around that... Now it is even more complicated. I wish that could be added. Clicking on the heading will only render "title search". Entering the string on the search box will search both, title and body. Anyone came come up with a patch for that? :-) -- DavidCollantes

The following sub should do it (rough guess, untested, my Perl skills are slim). You also need:

-- Tarquin
 sub SearchTitle {
  my ($string) = @_;
  my ($name, $freeName, @found);

  foreach $name (&AllPagesList()) {
    if ($name =~ /$string/i) {
      push(@found, $name);
    } elsif ($FreeLinks && ($name =~ m/_/)) {
      $freeName = $name;
      $freeName =~ s/_/ /g;
      if ($freeName =~ /$string/i) {
        push(@found, $name);
      }
    }
  }
  return @found;
 }

I just realized the Backlinks does exactly what I wanted.. Now if I could split the search results page (including the index) on multiple pages with a "Previous 50 - Next 50"... perhaps will come... :-)

But Baclinks finds strings, not "title only" --JuanmaMP

UseModWiki | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited December 27, 2009 11:46 pm by JuanmaMP (diff)
Search: