It's better when it's simple

User Tools

Site Tools


SearchFormGoTo Plugin

Compatible with DokuWiki

  • 2017-02-19 "Frusterick Manners" unknown
  • 2016-06-26 "Elenor Of Tsort" unknown
  • 2015-08-10 "Detritus" unknown
  • 2014-09-29 "Hrun" yes

plugin A plugin for DokuWiki which allows adding a "Go" button to the search form that will go directly to a page if the search exactly matches a page name. Otherwise operates as a normal search.

Last updated on

Similar to singlesearchresult

Tagged with redirect, search

How to use

You have to modify your template to use this plugin. Edit <dokuwiki home>/lib/tpl/<your template>/main.php and replace the line:

<?php tpl_searchform() ?>


<?php if (!plugin_isdisabled('searchformgoto')) {
	$searchformgoto = &plugin_load('helper','searchformgoto');
	} else { tpl_searchform(); }

Download and Installation

Download and install the plugin using the Plugin Manager using the following URL. Refer to Plugins on how to install plugins manually.

Change log


As of right now this doesn't work with a fresh install?

Fatal error: Call to undefined function tpl_gotoform()
I can't do it, not call tpl_gotoform with plugin installed
Is there other TODO ?
I'm not sure I understand your problem. It works fine in the installs I've done. Can you describe your issue in more detail? -Payton

I'd love to use this plugin, but the template I'm using (Monobook) uses a different piece of script for the search bar. I'm comfortable enough with searching and replacing lines of code when necessary, but I'm a newbie and *adapting* code is a little beyond me. Is there any way to turn the following searchform code into something that also works with your plugin?
> <?php if (tpl_getConf('mb_use_search')) { ?>
><div id="p-search" class="portlet">
>    <h5>
>        <label><?php echo $lang['monobook_bar_search']?></label></h5>
>    <div class="pBody">
>        <form action="<?php echo DOKU_BASE.DOKU_SCRIPT;?>" accept-charset="utf-8" id="dw__search" name="search">
>            <input type="hidden" name="do" value="search" />
>            <input id="qsearch__in" name="id" type="text" accesskey="f" value="" />
>            <input type='button' class="searchButton" id="searchGoButton" value="<?php echo >$lang['monobook_btn_go']?>" onclick="document.location.href='<?php echo DOKU_BASE.DOKU_SCRIPT;?>?id=' + >;" />&nbsp;
>            <input type='submit' name="fulltext" class="searchButton" value="<?php echo >$lang['monobook_btn_search']?>" />
>        </form>
>    </div>
Sorry if this is a dumb question. Thanks in advance!
Alan Gratz
Hm. It looks like that template defines its own search form entirely. I'm not entirely sure what that template is doing with the form, but here's two suggestions to try:
1. Replace all of the above code within the <div> tags with 'tpl_gotoform();'
2. [This one might be better] Add the following lines near the end of your template form (you may need to remove the hidden “do” input you already have):
<input type="hidden" name="do" value="goto" />
<input type="hidden" name="current_ns" value="'.$ns.'" />
<input type="submit" value="'.$lang['btn_go'].'" class="button" name="goto" title="'.$lang['btn_go'].'" />


Unfortunately, I get “undefined function tpl_gotoform” with the “simple” template.


For the issue of undefined function tpl_gotoform a little patch could be done:

  • Delete line 35, and 38-63 in action.php:
        $contr->register_hook('TPL_ACT_RENDER', 'BEFORE', $this, 'handle_act_render', array());
    function handle_act_render(&$event, $param) {
  • Add a file helper.php:
 * Searchformgoto Plugin
 * @license    GPL 2 (
 * @author     Payton Swick <payton (at) foolord (dot) com>
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
class helper_plugin_searchformgoto extends DokuWiki_Plugin {
    function gotoform($ajax=true,$autocomplete=true) {  
        global $lang;
        global $ACT;
        global $ID;
        // don't print the search form if search action has been disabled  
        if (!actionOk('search')) return false;
        print '<form action="'.wl().'" accept-charset="utf-8" class="search" id="dw__search"><div class="no">';
        print '<input type="hidden" name="do" value="goto" />';
        print '<input type="hidden" name="current_ns" value="'.cleanID(getNS($ID)).'" />';  
        print '<input type="text" ';
        if($ACT == 'search') print 'value="'.htmlspecialchars($_REQUEST['id']).'" ';  
        if(!$autocomplete) print 'autocomplete="off" ';
        print 'id="qsearch__in" accesskey="f" name="id" class="edit" title="[F]" />';  
        print '<input type="submit" value="'.$this->getLang('btn_go').'" class="button" name="goto" title="'.$this->getLang('btn_go').'" />';
        print '<input type="submit" value="'.$lang['btn_search'].'" class="button" name="goto" title="'.$lang['btn_search'].'" />';
        if($ajax) print '<div id="qsearch__out" class="ajax_qsearch JSpopup"></div>';
        print '</div></form>';
        return true;
  • Write this in the template where you want to display the search box (commonly replace tpl_searchform()):
<?php if (!plugin_isdisabled('searchformgoto')) {
	$searchformgoto = &plugin_load('helper','searchformgoto');
	} else { tpl_searchform(); }

— danny0838 2010/12/27 13:32

thanks danny0838!!! — S.C. YooS.C. Yoo

2014/01/04 16:45

plugin/searchformgoto.txt · Last modified: 2015-03-19 06:34 by