Bitrix Site Manager

CSite::GetList

CDBResult
CSite::GetList(
 string &by = "sort",
 string &order = "asc",
 array filter = array()
)

The method GetList returns the list of sites as an instance of CDBResult.

Parameters

ParameterDescription
by Field by which the sorting is to be performed. The following values are possible:
  • id - by the site ID;
  • active - active state flag;
  • name - site short name;
  • dir - root directory of the site content;
  • lendir -  length of the name of the site content root directory;
  • def - flag "Default site";
  • sort - sort weight.
Optional. "Sort" by default.
order Sort order. The following values are possible:
  • asc - ascending
  • desc - descending
Optional. "Asc" by default.
filter An array of the format Array("filtered field"=>"value" [, ...]). "Filtered field" can have the following values:
  • ID - the site ID;
  • NAME - the field "Name" of the site settings;
  • DOMAIN - the field "Domain" of the site settings;
  • IN_DIR - the field "Site folder" prefix of the site settings;
  • LANGUAGE_ID - double character ID of the site language;
  • ACTIVE - active state flag (Y|N)

See Also

Example



<?
$rsSites = CSite::GetList($by="sort", $order="desc", Array("NAME" => "www.mysite.com"));
while ($arSite = $rsSites->Fetch())
{
  echo "<pre>"; print_r($arSite); echo "</pre>";
}
?>