]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/search.pm
* POSIX::strftime doesn't know about encodings and doesn't return a utf8
[git.ikiwiki.info.git] / IkiWiki / Plugin / search.pm
index 213ed45ff29c00c19769cbee3ec00faf991ae667..c94974ac4b608bfbf122f4455a0fe3fc0fcc71a6 100644 (file)
@@ -9,6 +9,8 @@ use IkiWiki;
 sub import { #{{{
        IkiWiki::hook(type => "checkconfig", id => "hyperestraier",
                call => \&checkconfig);
+       IkiWiki::hook(type => "pagetemplate", id => "hyperestraier",
+               call => \&pagetemplate);
        IkiWiki::hook(type => "delete", id => "hyperestraier",
                call => \&delete);
        IkiWiki::hook(type => "change", id => "hyperestraier",
@@ -23,8 +25,14 @@ sub checkconfig () { #{{{
                        IkiWiki::error("Must specify $required when using the search plugin\n");
                }
        }
+} #}}}
+
+sub pagetemplate ($$) { #{{{
+       my $page=shift;
+       my $template=shift;
 
-       $IkiWiki::config{headercontent}.=qq{
+       # Add search box to page header.
+       $template->param(searchform => qq{
 <form method="get" action="$IkiWiki::config{cgiurl}" id="searchform">
 <div>
 <input type="text" name="phrase" value="" size="16" />
@@ -32,7 +40,7 @@ sub checkconfig () { #{{{
 <input type="hidden" name="do" value="hyperestraier" />
 </div>
 </form>
-};
+});
 } #}}}
 
 sub delete (@) { #{{{