Hi,
I need to limit “mod_search” module only to a section/category. I don’t want an option to choose.
I want the module to search directly to a predifined section/category.
I’m using joomla 1.5.25 and used to restrict modifying this file
plugins/search/content.php
replacing by this coding
********************************************
$wheres = array();
switch ($phrase) {
case ‘exact’:
$text = $db->Quote( ‘%’.$db->getEscaped( $text, true ).’%’, false );
$wheres2 = array();
$wheres2[] = ‘a.title LIKE ‘.$text;
$wheres2[] = ‘a.introtext LIKE ‘.$text;
$wheres2[] = ‘a.fulltext LIKE ‘.$text;
$wheres2[] = ‘a.metakey LIKE ‘.$text;
$wheres2[] = ‘a.metadesc LIKE ‘.$text;
$where = ‘(‘ . implode( ‘) OR (‘, $wheres2 ) . ‘)’;
break;
case ‘all’:
case ‘any’:
default:
$words = explode( ‘ ‘, $text );
$wheres = array();
foreach ($words as $word) {
$word = $db->Quote( ‘%’.$db->getEscaped( $word, true ).’%’, false );
$wheres2 = array();
$wheres2[] = ‘a.title LIKE ‘.$word;
$wheres2[] = ‘a.introtext LIKE ‘.$word;
$wheres2[] = ‘a.fulltext LIKE ‘.$word;
$wheres2[] = ‘a.metakey LIKE ‘.$word;
$wheres2[] = ‘a.metadesc LIKE ‘.$word;
$wheres[] = implode( ‘ OR ‘, $wheres2 );
}
$where = ‘(‘ . implode( ($phrase == ‘all’ ? ‘) AND (‘ : ‘) OR (‘), $wheres ) . ‘)’;
break;
}
$where .= ” AND catid IN(1,2)”;
********************************************
But when migrate to ja business tempate, this no longer works. All the categories are showing in the result.
How can I restrict the search again??