Add
mixed CSite::Add( array fields )
The method 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. Non-static method.
Parameters
Parameter | Description |
---|---|
fields | Array of field values in the array("field"=>"value" [, ...]) format. |
See Also
Examples of use
<? $arFields = Array( "LID" => "en", "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" => "en", "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; ?>
How to change site template:
if (strlen($site_id)) { $obSite = new CSite(); $t = $obSite->Update($site_id, array( 'ACTIVE' => "Y", 'TEMPLATE'=>array( array( 'CONDITION' => "", 'SORT' => 1, 'TEMPLATE' => "new_template" ), ) )); }
© «Bitrix24», 2001-2024