Views: 4819
Last Modified: 10.10.2012

Composite (compound, multi-page) components create the site sections. For example, the commercial catalog component creates the whole catalog section including the catalogs page, the groups page and the product pages. Essentially, a composite component is a set of pages from the visitor's point of view, but represented by a single page physically. The foundation of composite components are simple components and the use of the single-page logic.

The advantage of composite components is the automatic preparation of parameters of the underlying simple components: you do not have to care about the interrelationships of internal parameters.

Composite components resolve the following problems:

  • Avoid the creation of numerous pages to add all required sub-components to them. There is no need to configure common parameters of each individual component.
  • Avoid the need to establish composite associations between sub-components. For example, you do not have to configure the link creation rules etc.
  • Components (even those driven by custom view templates) can be enriched with new pages. For example, if you add page (sub-component) showing 10 most rated forum visitors, this page becomes momentarily available in the public section.
  • The component view template can be changed at one stroke instead of configuring each of the underlying sub-components.

A typical composite component workflow is as follows:

  • the component takes user actions on input and defines the exact page to show to a visitor and attaches an appropriate template to the page;
  • the page template attaches simple components and configures their parameters as required;
  • the simple components perform the requested operations: request data from the system kernel, format and display data to the visitor; show various controls (links, forms, buttons etc.);
  • the visitor sends a new request to the composite component using the controls.

A simple example of a composite component is the News (bitrix:news) component. The only required actions are add this component can be added to a page and configure its parameters.

Hence, the creation of a news section requires only one physical page but creates as many "virtual" pages as required. For example, the news index page:

Click on image to enlarge

the news details page:

Click on image to enlarge

Courses developed by Bitrix24