Content and design
Exponential keeps what a site says apart from how it looks. Content is structured data; design is the markup, style sheets and images that present it. Because the two are separate, the same article can be shown on a public site, in the administration, in an RSS feed and through the REST API, and a site can get a new look without touching its content.
Content
Content is any information you store to show later: the title, intro, body and image of a news article, or the make, model and price of a car. Its shape is defined by a content class, and every stored item is a content object of that class. Content is stored in the database, with images and files below var/ (see Storage). Rich text is stored as XML that describes structure (paragraphs, headings, links, embedded objects), not appearance.
Design
A design is a directory of templates, style sheets, images, fonts and scripts, in design/ of the installation or in an extension. A siteaccess chooses its design in site.ini [DesignSettings] SiteDesign, and can add others to search in AdditionalSiteDesignList[]. See Designs.
Templates connect the two
Templates are HTML with placeholders that the template engine fills with content. Exponential's own template language (.tpl files) is the default; Smarty (.stpl) and Twig (.twig) templates can be used in the same design and see the same variables. A template asks for content with fetch functions and shows each attribute with the template of its datatype:
<h1>{$node.name|wash}</h1>
{attribute_view_gui attribute=$node.data_map.body}
{def $children = fetch( 'content', 'list', hash( 'parent_node_id', $node.node_id, 'limit', 10 ) )}
<ul>
{foreach $children as $child}
<li><a href={$child.url_alias|ezurl}>{$child.name|wash}</a></li>
{/foreach}
</ul>
{undef $children}
Which template draws a page is decided by the design's search order and by override rules in override.ini, which can pick a template by class, node, section, view mode and more. That is how one design gives articles and folders different layouts. The Templates and design guide shows how to find the template behind a page and override it; The three template engines compared explains the choice between .tpl, Smarty and Twig.
Configuration completes the picture
Settings decide which design, languages and database a siteaccess uses, which classes appear where, and much more. They are INI files, described in Configuration.
In this section
Contributors
- Balazs Halasy
- Geir Arne Waaler
- Stig Andersen Commenter
- Graham Brookins Updated Maintainer
Comments (1 historical)
Written by readers of the earlier documentation sites, kept as they were.
Content format is required
Stig Andersen ·
It's worth noting that though separation of content and design allows for the two to be processed and handled separatly and by different people, the format of the content - at least to some extent - needs to be decided upon before any design can be made. in other words, the designer needs to know what he/she has to work with. A good place to start is a XML Schema or document definition.