[Pmwiki-users] Searchbox conversion to Pmwiki2

John Rankin john.rankin
Wed Dec 8 14:16:44 CST 2004


On Wednesday, 8 December 2004 4:49 PM, Patrick R. Michaud <pmichaud at pobox.com> wrote:
>> - an action=search that displays the results in the current page,
>>   including a SearchQuickReference page (in other words, it behaves
>>   like Edit Page)
>
>This seems like it could be accomplished by modifying $GroupHeaderFmt,
>something like...
>
>if ($action=='search') {
>   $GroupHeaderFmt = '(:include
>$Group.GroupHeader:)(:nl:)(:include Main.SearchWiki:)(:nl:)';
>   $action = 'browse';
>}
>
>Pm
>
What if $pagename includes a (:nogroupheader:)?

Here's the core of how I did it -- only a little longer.
The SearchQuickReference page could be Main.SearchWiki, but I
made it look like the other QuickReference pages.
(it uses a custom display fmt, which is optional)

SDV($HandleActions['search'],'HandleSearch');
SDV($PageSearchFmt,array("<h1 class='wikiaction'>$[Search Results]</h1>",
                         'markup:(:searchresults fmt=custom list=normal:)',
                         'wiki:$[PmWiki.SearchQuickReference]'));


function HandleSearch($pagename) {
  global $HandleSearchFmt,$PageStartFmt,$PageSearchFmt,$PageEndFmt,$FmtP;
  $FmtP['/\\$LastModified/e'] = '$GLOBALS[\'CurrentTime\']';
  SDV($HandleSearchFmt,array(&$PageStartFmt, &$PageSearchFmt, &$PageEndFmt));
  PrintFmt($pagename,$HandleSearchFmt);
}

The rest is "merely corroborative detail..." 
(http://math.boisestate.edu/gas/mikado/webopera/dialog15.html)
-- 
JR
--
John Rankin





More information about the pmwiki-users mailing list