Containers - Documentation topics on: code block,code re-use,container properties,containers,footers,headers,max contents,menu bar,navigation bar,zero content,.

Containers

Containers in dotCMS allow you to specify both what types of Content can be added to a Page and how content of each of those Content Types is displayed. Specifically, Containers allow you to perform the following important functions:

  1. Determine which Content Types a user can add to a Page.
    • A user can not add content of a given Content Type to a Page unless the Page's Template includes a Container that accepts content of that type.
  2. Create blocks of code which are re-usable on multiple Templates.
    • Containers (and especially Zero Content Containers) can contain code, which can then be shared among Templates and Pages by including the Container in multiple different Templates.
  3. Specify different and re-usable formatting and styling for each different Content Type that can be displayed in the Container.
    • Individual content items are placed inside Containers, Containers are placed inside Templates, and Templates are placed inside Pages. So individual content items are ultimately displayed (and formatted) in Pages via Containers.
    • You can also create different Containers that format and display the same Content Type in different ways (such as a summary view and a detailed view), allowing you to select how a Content Type is displayed in different Templates just by choosing the appropriate Container.

Page Components Diagram

Content Added to Containers

  • When content is added to a Container on a Page, that content will continue to appear on the Page even if the Template or Layout is changed, so long as the new Template or Layout includes the same Container the content was added to.
  • The same Container may be used multiple times on the same Template or Page Layout.
  • When the same Container appears multiple times on the same page, content added to one of the Containers is added to that specific Container (as identified by a unique number such as 1, 2, 3), and will only appear in the Page after a Template or Layout change if the same Container (including the numeric identifier) still appears on the Page after the Template or Layour change.