Views: 1707 (Data available since 06.02.2017)
Last Modified: 10.10.2012

Introducing Components

Components are blocks that build the site public section. They allow to reuse the existing, once written and debugged code on the same or different sites. The Bitrix Site Manager environment visual tools provide tools to add and configure the component parameters without having to create any task specific code. The Bitrix standard components are regularly updated, adding new functions and fixing possible errors.

Main Features of Components 2.0

The conceptual difference between the components 2.0 and 1.0 is that the components 2.0 separate the view from the business logic. More than one view can be created for a single logic unit. Views can include those depending on a current site template. A view (presentation template) can be created in any template language that can be used with PHP. For example: PHP, Smarty, XSL etc. There is no need to modify the component logic to modify the view. This has made the information view configuration much easier: a developer does not need to look deep into the component logic. The view template is much simpler than the component as a whole. The logic is a component, the view is a template of the component view.

Physically, the components are located in a single centralized storage (folder). This makes the site structure more integrate and comprehensive. The folder is available for read operations, which means that a component and its templates can easily use their additional resources.

Note! Files that cannot be accessed directly must start with the following code:
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>

A component keeps the private data in a private folder. That is why they can be easily shared between projects.

Important: components are atomic units.

Types of Components

Components can be simple (single page) or composite (multi-page). Though the simple and compound components are rather similar in their structure and the activation method, they are completely different in logic.



Courses developed by «Bitrix», Inc.