From: Neil B. <ne...@cs...> - 2000-10-07 00:13:50
|
Another patch for phpwiki. I like to be able to have a search form on each browser page (instead of having to go to a special search page. You can currently do this by customising browse.html. However you either have to choose beteen titlesearch and fullsearch, which is restruictive, or have two entry fields, which is noisy. The following patch allows you to have submit buttons (or even an option menu) that select which type of search by setting $searchtype, and provides a sample usage in browse.html NeilBrown --- ./templates/browse.html 2000/10/06 02:38:48 1.1 +++ ./templates/browse.html 2000/10/06 02:45:57 1.3 @@ -19,6 +19,12 @@ [<a href="###SCRIPTURL###?diff=###PAGEURL###">diff</a>]) <br> <a href="###SCRIPTURL###?FindPage">FindPage</a> by browsing or searching +<form action="###SCRIPTURL###"> +Search: +<input type='text' size=40 name=searchstring> +<input type=submit value=search name=searchtype> +<input type=submit value=full name=searchtype> +</form> <hr noshade> <small>###RELATEDPAGES###</small> --- ./index.php3 2000/10/06 02:21:24 1.1 +++ ./index.php3 2000/10/06 02:45:21 1.2 @@ -13,6 +13,15 @@ $dbi = OpenDataBase($WikiPageStore); + // To allow choice of submit buttons to determine type of search: + if ($searchtype == "search") { + $search = $searchstring; + } else if ($searchtype == "full") { + $full = $searchstring; + } else if ($searchstring) { + // default to plain search + $search = $searchstring; + } if ($edit) { $admin_edit = 0; |