Skip to the content
Documentation

The content class

No ratings yet

A content class is the definition of a type of content. It says which fields an item of that type has and how the system treats it. Every piece of content in Exponential, including users, user groups, images and folders, is an object of some class, so classes are where a site's content model is designed.

What a class defines

Property Meaning
Name and description What editors read, translatable into every content language.
Identifier The name templates, fetches, override rules and code use, for example article. Lower-case letters, digits and underscores; keep it stable once templates use it.
Object name pattern How an object's name is made from its attributes, for example <title> or <short_title|title> (the first one that has content).
URL alias name pattern The same for the node's address; empty means the object name is used.
Container Whether objects of the class may have children in the tree (a folder may, an image usually not).
Default sorting How the children of a new node are sorted: by name, published date, priority and so on.
Always available The default of that flag for new objects: shown in their main language when a siteaccess lists none of their languages. See Multiple languages.
Attributes The fields, each with a datatype. See Class attributes.
Class groups Folders of classes in the class list, for overview only.

The classes of a new installation

A new installation without a site package has ten classes in five class groups: Folder, Article, Link, File, Comment and Image for content, User and User group for accounts, and Common ini settings and Template look for setup. The groups are Content, Users, Media, Setup and Configuration. Site packages and extensions add their own classes.

Changing a class

Classes are edited under Setup > Classes (/class/grouplist): choose a group, then a class, then Edit. While you edit, your changes are kept in a temporary version of the class; nobody else sees them until you press OK, and Cancel throws them away.

The class Article in the class view of the administration, with its attributes and their datatypes

A class seen under Setup > Classes: its name, identifier, object name pattern and settings, then each attribute with its datatype and properties.

  • Adding an attribute adds it to every existing object of the class, empty or with the attribute's default.
  • Removing an attribute removes its data from every object, in every version. Export or copy what you need first.
  • Changing the datatype of an attribute is not possible; add a new attribute and move the data.
  • Changing an identifier breaks templates, fetches and override rules that use the old one.

Classes travel between installations as packages (Setup > Packages) or migrations. The class group pages are described in the Class groups guide.

Classes in templates

{* the class of the node being shown *}
{$node.class_identifier}          {* article *}
{$node.object.class_name|wash}    {* Article *}

{* only articles among the children *}
{def $articles = fetch( 'content', 'list', hash( 'parent_node_id', $node.node_id,
                                                 'class_filter_type', 'include',
                                                 'class_filter_array', array( 'article' ) ) )}

Override rules choose templates by class with Match[class_identifier]=article; see Designs.

Contributors

Comments (1 historical)

Written by readers of the earlier documentation sites, kept as they were.

  1. Attribute changes and inconsistent database

    Stig Andersen ·

    Would it not be possible to avoid this problem, however crudly, by using a database engine that has a greater support for ACID and more specifically transactions? MySQL supports both InnoDB and Berkely DB, while PostgreSQL I believe is transactional with it's own engine (or is that Berkely all over again). (Oracle is an obvious addition to this list, but then again - Oracle isn't free...)

Comments

Add a comment

Comments are read by a moderator before they appear.