Bitrix Site Manager

GetIBlockSection

array
GetIBlockSection(
 int ID,
 string type = ""
);

The function returns an information block section.

Parameters

ParameterDescription
ID Section ID.
type Optional type of information blocks to search for a section. Specified in the module settings. If present, the selected section is checked to match the type.

By default, no restrictions applied.

Return Values

The function returns an array of the information block section fields and a field IBLOCK_NAME (name of an information block). All fields returned by this method are HTML compliant and safe. If sections cannot be found, false is returned.

Remarks

The function succeeds only if a section is active, is contained in an active information block and is bound to the current site.

See Also

  • Fields of information block section
  • Example


    <?
    require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
    
    $APPLICATION->SetTitle("Section view");
    
    // include the module and select a section 
    // of information blocks of the type product
    if (CModule::IncludeModule("iblock") && 
        ($arIBlockSection = GetIBlockSection($_GET['ID'], 'product')))
    {
       // make the page title same as the section name
       $APPLICATION->SetTitle($arIBlockSection["NAME"]);
       // add the name and link to the current information block
       $APPLICATION->AddChainItem($arIBlockSection["IBLOCK_NAME"], 
                                  "products.php?ID=".$arIBlockElement["IBLOCK_ID"]);
       // display the image
       echo ShowImage($arIBlockSection["PICTURE"], 150, 150, 
                      "border='0'", "", true);
       // display the detailed description
       echo $arIBlockSection["DESCRIPTION"]."<br>";
    }
    else
       echo ShowError("Cannot find section");
    
    require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");
    ?>