<< | Cookbook-V1 | >>
Limit searches to a single group without requiring a group specifier in the search string.
In local.php, modify the form given by $SearchTagFmt to include a "group" control element:
$SearchTagFmt = "<form action='\$PageUrl' method='get'> <input type='hidden' name='group' value='\$Group' /> <input type='hidden' name='action' value='search' /> <input type='text' name='text' value='' size='40' /> <input type='submit' value='Search' /></form>";
When performing a search, the search.php script that comes with PmWiki/PmWiki searches all groups on a site unless restricted to a single group by either a "Group/" specifier at the beginning of the search string or a "group" control element in the search form. The solution given above modifies the search form generated by the [[$Search]] tag to include a group control element that restricts the search to the current group.For example, this search box will only search for pages in the Cookbook-V1 group.
Even with this modification, the user can still search a different group by including a group name and slash at the beginning of the search string.
For example, John Rankin creates a group pick list using the <select> and <option> elements, with the current group set to <option selected='selected'>. He does this by reading and sorting the pages listed on Main.AllRecentChanges to create a list of groups.
At present there's no way to search a limited number of groups; you can either search a single group or search all of them. However, Pm says he can modify search.php to allow multiple group searches if that's needed.
- Change the search results line to read "Searching for needle in haystack." The needle is the text being sought (or all) and the haystack is the group name (or all groups).
Here's 2 votes for Pm to modify search.php to allow multiple group seraches.
Search the WikiFarm would also be practical sometimes. PatrickOgay
The above search box actually searches all groups currently... The trick doesn't work!!!
It works now -- I didn't have this particular recipe enabled on t his page (the local customization didn't survive one of pmwiki.org's upgrades).
Hm, for me the search result of the above box still shows hits in all groups. Must be because this is a V1 recipe in a V2 wiki :-)
from IP: 22.214.171.124 ip should be disabled by default for security reasons