Bitrix Site Manager

CSite::Add

mixed
CSite::Add(
 array fields
)

The method Add adds a new site. Returns the ID of the added site. In case of an error the method will return false, and the LAST_ERROR property will contain the error description.

Parameters

ParameterDescription
fields An array of the field values in the form of array("field"=>"value" [, ...]).

See Also

Example



<?
$arFields = Array(
  "LID"              => "ru",
  "ACTIVE"           => "Y",
  "SORT"             => 200,
  "DEF"              => "N",
  "NAME"             => "www.site.com",
  "DIR"              => "/en/",
  "FORMAT_DATE"      => "DD.MM.YYYY",
  "FORMAT_DATETIME"  => "DD.MM.YYYY HH:MI:SS",
  "CHARSET"          => "windows-1251",
  "SITE_NAME"        => "My site",
  "SERVER_NAME"      => "www.site.com",
  "EMAIL"            => "admin@site.com",
  "LANGUAGE_ID"      => "ru",
  "DOC_ROOT"         => "",
  "DOMAINS"          => "www.site.com \n site.com"
  );
$obSite = new CSite;
$obSite->Add($arFields);
if (strlen($obSite->LAST_ERROR)>0) $strError .= $obSite->LAST_ERROR;
?>