Views: 10371
Last Modified: 10.09.2014
A component is the primary way to retrieve information in Bitrix Framework. Accordingly, it is the work with the component that opens the maximum possibilities to change data display conditions and change (add) system functionalities.
he following task/solution ratio is recommended:
- To solve tasks that are aimed at changing the data display form (design) modify the component template.
- In order to change and expand cached data displayed by the component, please use the options of the file result_modifer.php.
- In order to implement the logic executed upon each call of the component irrespective of cache, use the options of the file component_epilog.php.
- In order to make additions and implicit changes (without interfering with the code) of component operation logic the technique of Events can be used.
- To expand the component operation logic, copy the component to its namespace and change it.
- To create new logic and new options, create a new component.
Quite often a task has to be solved using a combination of methods. I.e., for example, editing the template and adding a code in result_modifier.php.
In the chapters that follow, we will review the work with components in the indicated order of tasks and solutions.
Attention! When performing any actions while working with components, please do not forget about caching. Heavy coding introduced in component_epilog.php not be subject to cache. However, there are situations when it is better to customize the component and it may result in better performance (especially when a heavy code is used on a home or a most frequently visited page).