Start now free!

Bitrix Products Technical FAQ

Using the Information Blocks Module

  • How to show banner in the news text?
  • How do I create and use my own templates for customization of information block elements?
  • How do I obtain subsections of all levels of a certain section of an information block?
  • How do I select all elements of subsections of a section of an information block?

  • How to show banner in the news text?
    If you want to place a banner in the information block detail text you can do the following:

    1) Include delimiter #BANNER_BOTTOM# in the detail text. The second part "BOTTOM" here is the "type" of banners that will be shown.

    2) Make file "result_modifier.php" with the following code:


    <?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();
    $arResult["DETAIL_TEXT"] = preg_replace(
    "/#BANNER_([A-Za-z-0-9]+)#/e",
    'CAdvBanner::GetHTML(CAdvBanner::GetRandom("\1"))',
    $arResult["DETAIL_TEXT"]
    );?>

    This file should be located in the folder of appropriate news component template (the template itself should be copied to the site current template folder).

    How do I create and use my own templates for customization of information block elements?
    Is it possible to create new templates for editing and storing the information block elements? How do I apply them?

    Your own field save handler scripts and the custom editing forms can be activated for a certain type of information block in its settings.

    You can perform any actions on the form data in your form data processing script before saving. The data will be then passed for the standard processor.

    Here are some examples of these files and their configuration: http://www.bitrixsoft.com/help/source/iblock/help/en/developer/custom.php.html

    How do I obtain subsections of all levels of a certain section of an information block?

    Say there is a G1 section containing subsections SG1, SG2, SG3.

    Each of the subsections contains other subsections: SG11, SG12, SG21, SG32 etc.

    Is it possible to fetch all subsections at once filtering by the G1 section?
    Yes. It is possible. Use the LEFT_MARGIN and RIGHT_MARGIN properties in filter without specifying the ID of a parent group.

    $sections = GetIBlockSectionList(<id of inf. Block of section G1>, false, Array(), false, Array("LEFT_MARGIN"=><value of LEFT_MARGIN of G1>, "RIGHT_MARGIN"=><value of RIGHT_MARGIN of G1>));


    How do I select all elements of subsections of a section of an information block?

    Say there is a section G1 containing subsections SG1, SG2, SG3.

    Each of the subgroups contains elements.

    Is it possible to fetch all elements at once filtering by the G1 group?

    Yes. You can do this by adding the following key to the filter array:

    "INCLUDE_SUBSECTIONS"=>"Y"

    For example:

    $items = GetIBlockElementListEx("news", Array(), Array(), Array("ACTIVE_FROM"=>"DESC", "SORT"=>"ASC", "NAME"=>"DESC"), 10, Array("SECTION_ID"=><id of section G1>, "INCLUDE_SUBSECTIONS"=>"Y"));


    Partner Program
    Free Online Training
    Subscribe to Bitrix News