Documentation

Update

bool
CIBlockSection::Update(
 int ID,
 array arFields,
 bool bResort = true
 bool bUpdateSearch = true
);

The method modifies parameters of a section.

Parameters

ParameterDescription
ID Section ID.
arFields An array of the format Array("field"=>"value", ...), containing values of the information block section fields.
bResort If set to true, tells to recalculate the left and right margins (fields LEFT_MARGIN and RIGHT_MARGIN). Set this parameter to false if you do not modify fields affecting the margins, or if you perform a series of calls. In the latter case, set this parameter to false, perform the required calls and then invoke ReSort.
bUpdateSearch Specifies the section should be indexed for searching right after the save.

Return Values

The method returns true on success. In case of failure, it returns false and sets the property LAST_ERROR to the error description.

See Also

  • CIBlockSection::Add

    Example


    <?
    $bs = new CIBlockSection;
    
    $arPICTURE = $_FILES["PICTURE"];
    $arPICTURE["MODULE_ID"] = "iblock";
    
    $arFields = Array(
      "ACTIVE" => $ACTIVE,
      "IBLOCK_SECTION_ID" => $IBLOCK_SECTION_ID,
      "IBLOCK_ID" => $IBLOCK_ID,
      "NAME" => $NAME,
      "SORT" => $SORT,
      "PICTURE" => $arPICTURE,
      "DESCRIPTION" => $DESCRIPTION,
      "DESCRIPTION_TYPE" => $DESCRIPTION_TYPE
      );
    
    if($ID > 0)
    {
      $res = $bs->Update($ID, $arFields);
    }
    else
    {
      $ID = $bs->Add($arFields);
      $res = ($ID>0);
    }
    ?>
  • © «Bitrix24», 2001-2024
    Up