Skip to content

Content Types mini howto

Matteo E. Minnai edited this page Mar 21, 2013 · 12 revisions

Content Types in Entando mini-howto

Definition and real world examples

Table of Contents

Introduction

The purpose of this howto is to provide a description of Content Types, how they are represented and used in an Entando Portal.

Target Audience

This document is for those who are preparing to develop a new portal using the Entando platform. So the recipients are experts in graphical interfaces for Web and Java developers.

Prerequisites

In order to take the maximum advantage of the present document, it is necessary to have a clearly defined Editorial Plan and knowledge base to use the development environment, as explained in other guides.

top

What Content Types are

In a nutshell, a Content Type is the summary of the attributes which compose a Content.

In Entando, Content Types are managed through the administration interface in a way that their representation is completely hidden to the final user; Entando from the very beginning relies heavily on XML for data representation, and Content Types are no exception.

However, knowing their representation, as found in the table sysconfig - item contentTypes - of the Port database, is still useful to understand the logic underlying them.

Content Types are not the only players involved in the representation of the Contents, but they are unique in that they define only the information conveyed to portal users. Content Types have nothing to do with the graphical presentation of a Content in the portal.

For further information about Contents and all the elements involved in their configuration please consult the document The Entando Model.

top

How to create a new Content Type

In this example we are going to create a Content Type for a generic portal content.

The designer, for instance, might decide to have a title, an abstract, a body which can contain HTML tags, two images and a variable list of attachments to download.

Creating Contents (Types) is fairly simple and can be accomplished with few clicks in the administration area. From the left menu → ContentsContent Types.

Clicking on the link New Entity Type the administrator accesses in the configuration page where all the aspects of the Content Type can be configured and then edited.

It is worth noting that Content Types are standard Entando Entities in use by the Content Management System plugin, bundled with the Entando.

The first thing the administrator is asked for are the three characters code which uniquely identifies the Content Type, then the description.

After that it is a matter of adding the Content Attributes available and configuring them as needed.

The configuration page is shown in the picture below.

In the Info section the unique key is CNG and the Description is Generic Content.

In the Metadata area we have specified only the Page for the On-the-fly-publishing; the Default Content Model and the Default content Model for list, used respectively to show the detailed view of the Content and its representation as an element in a list, will be created later, hence are not yet available.

For more information about Content Models please consult the document Content Models mini-howto.

In the Attributes sections the Type drop-down menu contains all the Attributes available: the Add button will start the configuration of the single attribute.

Please note that the description of the configuration of the Attributes available is beyond the scope of the current document: we are going to show only the configuration of the Title, which is a Text attribute. The remaining attributes are configured in a similar way.

In the Info section we have specified the key (name) of the attribute; remember that the length must be less or equal to 10 characters.

We also declared it as Mandatory and Searchable; we also want this attribute available to be used as a filter when generating lists of contents.

In the Roles section it is possible to assign the Attribute Role (not to be confused with the Users Roles!) jacms:title to this attribute so that other plugins or other services will know that within the CNG entity this attribute is a title, whatever the key is; however, for sake of clarity, the Key of the attribute is Title.

The remaining sections, Settings and Validation – OGNL can be left empty.

At this point just click on the Continue button.

The Text attribute requires no additional configuration step, so the administrator returns to the summary page, were the actual status is shown:

To complete the Generic content setup just add an attribute Abstract of type Longtext, Body (type Hypertext), Image_1 (type Image), Image_2 (type Image), a list of URL called Links (type Monolist) and finally a list of attachments called Attach (type Monolist).

Please remember that the new Content Type will be saved only when the Save button is pressed; leaving the configuration without saving will lead to the loss of the Content Type.

top

Content Type representation

The content created in the previous chapter above will have a XML representation similar to the following:

<contenttype typecode="CNG" typedescr="Generic Content"
  viewpage="contentview" listmodel="11" defaultmodel="1">
  <attributes>
  	<attribute name="Title" attributetype="Text" indexingtype="text"
			searcheable="true" required="true" />
		<attribute name="Abstract" attributetype="Longtext"
			indexingtype="text" />
		<attribute name="Body" attributetype="Hypertext"
			indexingtype="text" />
		<attribute name="Image_1" attributetype="Image" />
		<attribute name="Image_2" attributetype="Image" />
		<list name="Links" attributetype="Monolist" nestedtype="Link" />
		<list name="Attach" attributetype="Monolist" nestedtype="Attach" />
	</attributes>
</contenttype> 

Let's say this content is a content of a portal called myportal: the XML above will be found in the database myportalPort, table sysconfig and in the row contentTypes.

For each content we define:

  • typecode: a unique code that distinguishes the Content Type; it must be composed by 3 alphanumeric characters. In the example CNG.

  • typedescr: a brief description that will appear during the creation of the Content in the Administration area. In the example Generic Content.

  • viewpage: the code of the page prepared to display the complete content. This is also the default page for the so called on-the-fly publication. In the example contentview.

  • listmodel: code of the Content Model used to display the content as an item in a list. In the example 11.

  • defaultmodel: code of the default Content Model. In the example 1.

  • a list of Attributes: the comprehensive list of the attributes which form the Content Type. In the example Title, Abstract, Body etc.

For more information on Attributes please consult the document Attributes Types For Contents.

top

Real life Examples

In this chapter we are going to show a number of existing Content Types: the generic Content Type (shown in the previous chapter), the news Content Type and the event Content Type are commonly used across different types of portals.

We are going to show the XML resulting from the configuration in the administration area.

News

    <contenttype typecode="NEW" typedescr="News" viewpage="newsview" listmodel="21"
        defaultmodel="2"> 
      <attributes> 
        <attribute name="Date" attributetype="Date" searcheable="true" required="true" /> 
        <attribute name="Title" attributetype="Text" 
        indexingtype="text" searcheable="true" required="true" /> 
        <attribute name="Abstract" attributetype="Longtext" indexingtype="text" /> 
        <attribute name="Text" attributetype="Hypertext" indexingtype="text" /> 
        <attribute name="Image" attributetype="Image" /> 
        <list name="Links" attributetype="Monolist" nestedtype="Link" /> 
        <list name="Attachs" attributetype="Monolist" nestedtype="Attach" /> 
      </attributes> 
    </contenttype>

This Content Type, NEW, has the following fields: Date, Title, Abstract, Text, Image, a list of references ( Links ) and a list of attachments ( Attach ): this kind of content is used to publish news in the portal; a fundamental attribute is the Date attribute.

Event

<contenttype typecode="EVN" typedescr="Event" viewpage="eventview"
  listmodel="31" defaultmodel="3">
	<attributes>
		<attribute name="dateStart" attributetype="Date"
			searcheable="true" required="true" />
		<attribute name="dateEnd" attributetype="Date" searcheable="true"
			required="true" />
		<attribute name="Subject" attributetype="Text" indexingtype="text"
			searcheable="true" required="true" />
		<attribute name="Abstract" attributetype="Longtext"
			indexingtype="text" />
		<attribute name="Descr" attributetype="Hypertext"
			indexingtype="text" />
		<attribute name="Image" attributetype="Image" />
		<list name="Links" attributetype="Monolist" nestedtype="Link" />
		<list name="Attach" attributetype="Monolist" nestedtype="Attach" />
	</attributes>
</contenttype>

In the example above the Event Content Type contains a start date ( dateStart ), an end date ( dateEnd ), Subject, an Abstract, a description ( Descr ), an Image, a list of references ( Link ) and a list of attachments ( Attach ). This Content Type is used to publish events which have an initial date and a final date explicitly defined.

top

Noticeable Content Types

Some Contents Types are special in that they are used together with a particular plugin or are suitable only for some portal types.

Please remember that all those examples come from real working portals but they are just a possible solution to common requests; you can address them in ways different than those shown here.

Photo gallery Image

<contenttype typecode="SIM" typedescr="Image summary"
  viewpage="photogalleryview" listmodel="41" defaultmodel="4">
	<attributes>
		<attribute name="Image" attributetype="Image" required="true" />
		<attribute name="Caption" attributetype="Text" searcheable="true"
			required="true" />
		<attribute name="Detail" attributetype="Hypertext"
			searcheable="true" />
	</attributes>
</contenttype>

This content type is commonly used with the photo gallery plugin (whose code is jpphotogallery ): each image presented in the portal has a content type with an Image and a Caption and a Detailed description.

Download card

<contenttype typecode="SDL" typedescr="Download Card"
  viewpage="dlview" listmodel="51" defaultmodel="5">
	<attributes>
		<attribute name="Oggetto" attributetype="Text" indexingtype="text"
			searcheable="true" required="true" />
		<attribute name="Date" attributetype="Date" searcheable="true"
			required="true" />
		<attribute name="Abstract" attributetype="Hypertext"
			indexingtype="text" required="true" />
		<attribute name="Descr" attributetype="Hypertext"
			indexingtype="text" />
		<attribute name="Image" attributetype="Image" />
		<attribute name="File" attributetype="Attach" required="true" />
		<list name="Links" attributetype="Monolist" nestedtype="Link" />
	</attributes>
</contenttype>

The following Content Type is suitable for a downloadable resource in the portal for example Documents of a public administration or packages for a software release. All attributes retain the same meaning of the previous examples.

top

Specialized Content Types

Attributes can be combined to store and carry any information; the following example shows a Content Type aimed at profiling users for an address book. As always, there might be other ways to accomplish the same task, this is just an example taken from an actual portal.

<contenttype typecode="VEL" typedescr="Voce Elenco Telefonico"
  viewpage="contactview" listmodel="61" defaultmodel="6">
	<attributes>
		<attribute name="Role" attributetype="Text" indexingtype="text"
			searcheable="true" />
		<attribute name="Surname" attributetype="Text" indexingtype="text"
			searcheable="true" />
		<attribute name="Name" attributetype="Text" indexingtype="text" />
		<attribute name="Picture" attributetype="Image" />
		<attribute name="eMail" attributetype="Text" indexingtype="text" />
		<attribute name="Tel" attributetype="Text" indexingtype="text" />
		<attribute name="Mobile" attributetype="Text" indexingtype="text" />
		<attribute name="privMobile" attributetype="Text"
			indexingtype="text" />
		<attribute name="Fax" attributetype="Text" indexingtype="text" />
		<attribute name="privFax" attributetype="Text" indexingtype="text" />
	</attributes>
</contenttype>

top

Clone this wiki locally