Documentation

CSearch Constructor

CDBResult
CSearch( string strQuery, string LID = false, string MODULE_ID = false, string ITEM_ID = false, string PARAM1 = false, string PARAM2 = false, array aSort = array(), array aParamsEx = array(), bool bTagsCloud = false );

CSearch class constructor returns the index entries that satisfy the specified query string and to specified parameters and which are available for viewing for the current visitor (according to the visitor's access permission level).

Note: this method is deprecated, it is recommended to use the CSearch::Search method, as shown in the example below.

See Also

Examples of use

<?
$q = "fried fish or herring";
$module_id = "forum";
//This string to be replaced by
//$obSearch = new CSearch($q, LANG, $module_id);
// the next one:
$obSearch = new CSearch;
$obSearch->Search(array(
"QUERY" => $q,
"SITE_ID" => LANG,
"MODULE_ID" => $module_id,
));
if ($obSearch->errorno!=0):
?>
<font class="text">Error found in the search query:</font>
<?echo ShowError($obSearch->error);?>
<font class="text">Correct the search phrase and repeat the search query.</font>
<?
else:
while($arResult = $obSearch->GetNext())
{
?>
<a href="<?echo $arResult["URL"]?>"><?echo $arResult["TITLE_FORMATED"]?></a>
<?echo $arResult["BODY_FORMATED"]?> <hr size="1" color="#DFDFDF"> <? } endif; ?>


© «Bitrix24», 2001-2024
Up