Chapter 3. Defining and Creating Content Classes

To make a table we need some wood

to make some wood we need a tree

to make a tree we need a seed ...

"Ci vuole un fiore", a children's song by Gianni Rodari

In this chapter, we will look at what the content class is for eZ Publish, and how to create and manage it. We will define all of the content classes needed by our site to create articles and staff profile pages.

Before opening a browser and starting to create new content classes, we have to take a few minutes to learn what a content class is, how eZ Publish manages the content, and how this content will help us in our work. We also need to decide what we will want to publish on the site by defining all of the appropriate content classes.

Managing the content

One of the main scopes of a CMS is to manage any kind of content and data structure with as little effort for the users as possible. So it is very important to handle the content with enough flexibility to allow choosing what to show and what not to show in any possible context.

For example, a good CMS should allow us to store a lot of information on an article, useful for internal use, and choose not to show on the site frontend, because it is not necessary for readers. Or, instead, a CMS, gives us the ability to update our articles by adding information and rewriting them easily.

So, we not only need a complete decoupling of the content from the design, but also the ability to manage the content in different possible ways.

Separation of content and design

If the content can be defined as the action to store data in some way, the purpose of the design is to display that data. One of the key features of eZ Publish is the complete separation of content and design. This gives the ability to create different kinds of content structure and reuse them for different purposes, permitting developers and designers to work separately, publish content in different formats, and rewrite a complete interface without any development issue.

Content structure in eZ Publish

Unlike other CMS platforms, eZ Publish doesn't assign a fixed content type based on a strict definition.

However, it uses the content class paradigm. Any kind of content is a content class that is built on top of a content attribute. A user can, at any time, merge in different attributes to create a new content class, or edit an existing one. Moreover, a developer can also create a new content attribute to extend the system without any virtual limits.

Object-oriented content

As we say, all of the content classes are defined by one or more attributes, and each of these attributes are defined by an input field. So, we can say that eZ Publish uses an object-oriented approach to describe the content, where the main object inherits the attributes' characteristics and exposes them to the user as input forms.

Moreover, we have to understand that when we talk about content classes, we are not talking about its data. The content classes are only the definitions of the content object structure. Content objects, however, are instances of content classes in which we can store our data.

For example, we can use the following image from the eZ Publish documentation, where we have the Article content class that is used to generate three different Article objects:

Object-oriented content

As we can see in the next image from the official eZ System documentation, a content object should have one or more versions. Now, this version should be both a translation and a revision of the object itself, and should be able to be placed as a node inside the content tree of eZ Publish.

Object-oriented content
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.239.44