Search Page
From FundaWiki
Fundanemt supports out-of-the box search functionality which can easily be added to your website.
The search text-field can either be added directly in the index.php template file and thus be available on all pages or be added in a php-element on a specific search page, which at the same time just as well might function as the page that displays the search results.
// Disable highligthing of search results on this page.@@ $this->setHLMode();
// If user has submited a search query, search and display results.
if (isset($_GET["HL"])) {
$this->makeSearch("Your search for KEYWORD returned the following pages:", true);
} else {
print '<form action="'.$this->printURL(74, true).'" method="get">';
print '<input type="text" name="HL" value="">';
print '<input type="submit" value="Search">';
print '</form>';
}
First the code disables highligthing of search queries on the result page, where we might highligth things double. Next we check if we should display the search results or a search formular (the latter is almost trivial :)
To perform the search and display results we use the makeSearch() method.
1. First argument is the text that is displayed in the top of the result page.
2. Second argument is if we want to display the full path to the page (e.g. About me -> C.V. where C.V. is the page containing the search criteria.)
3. Third and optional criteria is an array containing pages to include in the search (all other pages are excluded).
1. example argument: array(1, 3, 7, 8, 9)
