array
GetIBlock(
string ID,
type = ""
);
The function returns an information block by its ID.
Parameters
Parameter | Description |
ID |
Information block ID. |
type |
Type of the information block. Specified in the module settings. If present,
the selected block is checked to match this type. Optional. By default, no
restrictions applied. |
Return Values
The function returns an array of the
information
block fields. All returned fields are HTML compliant and safe. Variables
#SITE_DIR#
and
#IBLOCK_ID#
are replaced with their corresponding values
(fields LIST_PAGE_URL and DETAIL_PAGE_URL). If no block is found,
false
is returned.
Remarks
The function succeeds only if a block is active and is bound to the current site.
See Also
Fields of information blocks
Example
<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle("Products");
// check if the module is installed and get the block with the ID of $BID and type of catalog
if(CModule::IncludeModule("iblock") && ($arIBlock = GetIBlock($_GET["BID"], "catalog")))
{
// make the page title same as the block name
$APPLICATION->SetTitle($arIBlock["NAME"]);
// add title to the navigation chain
$APPLICATION->AddChainItem($arIBlock["NAME"], $arIBlock["LIST_PAGE_URL"]);
// other operations
// ....
}
else
ShowError("Cannot find the information block.");
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");
?>