While templates define the static frame of a website, OpenCms inserts content dynamically for the
<cms:container> tag. A template may define one or more containers.
The most important attributes of
<cms:container> are these:
name. Unique name of the container. Required attribute. The name must be unique for the template. In the example above, the container
main. There may be containers named
footerdefining other places on the website where content elements can be inserted.
type. A comma separated list of container type identifiers. Optional attribute. If not defined, content elements of any type can be inserted into a container. Although the attribute is optional, the content types allowed should be restricted. In the example above, content elements of type
faqcan be inserted in the
maxElements. The maximum number of elements that can be placed in a container. Optional attribute, defaults to 100. The
maxElementsattribute in the example above restricts the number of elements to 30.
editableby. Specifies who is allowed to add, edit, and remove elements from a container. Optional attribute. If not set, any logged in user has permissions. Typically, roles are specified, e.g.,
ROLE.DEVELOPER, etc. In the example above.
Above the three attributes, there should be an HTML
<div> tag (or another HTML block element) inside a container representing a drop area to insert contents. Since the
<div> tag is shown when a container is empty, make sure that the
<div> has a defined width and height.