int CIBlock::Add( array arFields );
Adds a new information block.
Parameter | Description |
---|---|
arFields |
An array of the format Array("field"=>"value",
...). Contains values of all fields of an information block. The field SITE_ID must contain an array of identifiers of the sites to which the new block is to be bound. The field GROUP_ID with an array of pairs "user group code=>access permission" may be used to set the access permissions for different user groups to the information block (see CIBlock::SetPermission). |
<? $arPICTURE = $_FILES["PICTURE"]; $ib = new CIBlock; $arFields = Array( "ACTIVE" => $ACTIVE, "NAME" => $NAME, "CODE" => $CODE, "LIST_PAGE_URL" => $LIST_PAGE_URL, "DETAIL_PAGE_URL" => $DETAIL_PAGE_URL, "IBLOCK_TYPE_ID" => $type, "SITE_ID" => Array("en", "de"), "SORT" => $SORT, "PICTURE" => $arPICTURE, "DESCRIPTION" => $DESCRIPTION, "DESCRIPTION_TYPE" => $DESCRIPTION_TYPE, "GROUP_ID" => Array("2"=>"D", "3"=>"R") ); if ($ID > 0) $res = $ib->Update($ID, $arFields); else { $ID = $ib->Add($arFields); $res = ($ID>0); } ?>
© 2001-2005 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |