Views: 6241
Last Modified: 10.10.2012
Calling components on a site page is implemented with use of the function IncludeFile()
. The following parameters are used as the function attributes:
- path to the file with required component source code;
- properties assigned (by user) for placed on a page component.
<?
// this component displays an information block element detailed information
$APPLICATION->IncludeFile("iblock/catalog/element.php", Array(
"IBLOCK_TYPE" => "catalog", // Information block type
"IBLOCK_ID" => "21", // Information block
"ELEMENT_ID" => $_REQUEST["ID"], // Element ID
"SECTION_URL" => "/catalog/phone/section.php?", // URL to the information block section page
"LINK_IBLOCK_TYPE" => "catalog", // Type of information block elements of wich are linked with current element
"LINK_IBLOCK_ID" => "22", // ID of information block elements of wich are linked with current element
"LINK_PROPERTY_SID" => "PHONE_ID", // Property containing the link between information blocks elements
"LINK_ELEMENTS_URL" => "/catalog/accessory/byphone.php?", // URL to the page with list of linked elements
"arrFIELD_CODE" => Array( // Fields
"DETAIL_TEXT",
"DETAIL_PICTURE"),
"arrPROPERTY_CODE" => Array( // Properties
"YEAR",
"STANDBY_TIME",
"TALKTIME",
"WEIGHT",
"STANDART",
"SIZE",
"BATTERY",
"SCREEN",
"WAP",
"VIBRO",
"VOICE",
"PC",
"MORE_PHOTO",
"MANUAL"),
"CACHE_TIME" => "3600", // Cache time
));
?>
Files pertaining to a component can be stored in the following directories:
- in the folder of a module to which this component relates (i.e. in the product kernel). For example, the information blocks components are stored in the following folders:
/bitrix/modules/iblock/install/templates/iblock/news/
or /bitrix/modules/iblock/install/templates/iblock/catalog/
;
- in the folder of site template for which these components were customized. For example:
/bitrix/templates/<template_ID>/iblock/news/
or /bitrix/templates/<template_ID>/iblock/catalog/
;
- в in the default templates folder. For example:
/bitrix/templates/.default/iblock/news/
or /bitrix/templates/.default/iblock/catalog/
.