Learning: Sections

Nodes provide the tree structure of the site and define where an object is displayed. Sections provide the ability to then apply particular rules to a particular object regardless of where they appear in the node tree.

By assigning objects to sections you can created groups of objects and apply individual rules to each group. Eg. you make choose to restrict access to all objects in a particular section unless the user has logged in or you may wish to apply a particular template to objects within a section so that they have a particular look & feel.

There are some rules

  • An object can only belong to one section
  • Section ID’s can’t be re-used or recycled.

A default eZ publish installation comes with the following sections:

  • Standard (1)
  • Users (2)
  • Media (3)
  • Setup (4)

Assigning Sections

When a new object is created, its section ID will be the default section. When published, the object will inherit the section from it’s parent node & associated object.

In the case of objects that have multiple locations (ie. are associated with more than one node) the object will inherit the section id of it’s parent node. This means if the section ID of the parent node is changed, then the child object section ID will also change.

Managing Sections

Even though sections are associated with objects, the administration interface allows you to manage sections at the node level. That means the object associated with the node inherits the section assigned to the node. This can be a little confusing when the relationship is with the actual object but it does make it easier to manage.

For instance, when the section of a node is changed, the section of the object that belongs to that node will be updated.

When the section of a node is changed, the section of all subsequent children of that node will also be changed.

Note: as a section can apply rules for permissions & templates, removing a section can corrupt a site and should only be done with great care and consideration.