How can I modify the Joomla search component to use default search areas?
I'm using a Joomla 1.5 installation and the Joomla search component allows you to search in certain "search areas": Articles / News Feeds / Sections / Categories / Web Links ...
I don't want my users to have to worry about these things however and I also don't want them getting "sections" or "categories" as results - it's just a simple site with about 5 fixed pages and some simple news/event announcements that I use articles for.
I want to set some default "search areas" to use, and hide the search areas from the search results page. Hiding the search areas from the results page wasn't a problem - I just modified the default_form.php in the com_search component.
However, I have no idea how the "search areas" actually work and how I can change the functionality that the search function always only searches on "Articles" and nothing else...
There's two places where I can see it coming back:
In controller.php (in the com_search component) - you get the areas from the checkbox-list on the page:
$areas = JRequest::getVar('areas', null, 'post', 'array');
if ($areas) {
foreach($areas as $area)
{
$post['areas'][] = JFilterInput::clean($area, 'cmd');
}
}
In search.php (also in the com_search component) - you get the areas as specifie开发者_Go百科d and add them as "active areas" for your search query:
$areas = JRequest::getVar('areas');
$this->setAreas($areas);
Instead I wish to add my own $areas variable, but I have no idea what it contains and how I might change it to a default value of only 'Articles'.
The areas are driven by the search plugins in the backend. Have a look at the list of plugins and disable the ones you don't want.
精彩评论