Content Elements

Search
Feedback

Content Elements are the elements of a page tree that contain the actual text content of a page.

A content element can contain plain text, HTML, JavaScript code, and a variety of markup dialects (see below). In addition to static text, a content element can also contain one or more Template Expressions to create dynamic content.

Supported MIME Types

A content element can be configured to display one of the following MIME types. Structr will format and escape the output text according to the contentType attribute.

  • Plaintext
  • HTML
  • CSS
  • JavaScript

Additionally, Structr supports the following markup dialects out of the box.

  • Markdown
  • Textile
  • Mediawiki
  • Tracwiki
  • Confluence
  • Asciidoc

The MIME type of a content element can be configured with the Content-Type menu in the content editor. If the MIME type of a content element is set to one of the markup dialects, Structr will use the appropriate renderer to create HTML output from the content of the element.

Content Editor

Advanced Usage

One of the outstanding abilities of Structr is the combination of static and dynamic content in a single HTML element. The below snippet for example creates a (client-side) JavaScript block that uses a database query to fill a String. The resulting string can be used in client-side JavaScript code without the need to fetch additional data from the database.

<script language="JavaScript">
    var users = '${join(project.users, ',')}';
    var list  = users.split(',');
    list.forEach(function(userName) {
        /* .... */
    });
</script>

Graph-Browser

About this article
Last change 2017-05-04
Topics FrontendFunctionsStructr 2.0