[Pmwiki-users] search and jump form works

Andres Yver yver
Thu Mar 4 19:52:55 CST 2004


A while back we were wondering how to combine a search and jump box, 
such that if a valid wiki pagename were entered you'd jump to it or be 
redirected to SearchWiki.

Pm pointed me to his nifty JumpBox script in the cookbook:
http://www.pmichaud.com/wiki/Cookbook/JumpBox

We snipped away everything except

if ($action=='jump') {
   $text = stripmagic($HTTP_GET_VARS['text']);
   if 
(preg_match("/^$GroupNamePattern([\\/.])$PageTitlePattern$/",$text))
     $jumpto=$text;
   elseif (preg_match("/^$PageTitlePattern$/",$text))
     $jumpto=FmtPageName("\$Group.$text",$pagename);
   if ($jumpto && PageExists($jumpto)) Redirect($jumpto);
   $action='$ScriptUrl/$[SolaRoof/SearchWiki]';
}

and added

<input type='hidden' name='action' value='jump' />

to our search form in the template file.

WooHoo!

test it at

www.solaroof.org

cheers,
andres




More information about the pmwiki-users mailing list