Contao Open Source CMS > Understand > User's guide > Managing content > How to manage articles in Contao

How to manage articles in Contao

Articles are containers for content elements. Grouping content elements that belong together makes it easy to move, publish, copy, edit or export them all at once instead of one by one. Each article is associated with a particular page and layout section and therefore has a fixed position in the site structure and on the website. Contao optionally shows only the article teaser with a Read more link.

Content elements

Content elements are an easy and intuitive way to create content. Instead of just using a Rich Text Editor, Contao provides a separate element for each type of content like texts, lists, tables, hyperlinks, images or downloads. Here is an overview of the Contao core content elements:

NameCSS classDescription
Headlinece_headlineGenerates a headline (h1 - h6).
Textce_textGenerates a rich text that can be formatted using TinyMCE.
HTML-Allows you to add custom HTML code.
Listce_listGenerates an ordered or unordered list.
Tablece_tableGenerates an optionally sortable table.
Accordionce_accordionGenerates a MooTools accordion pane.
Codece_codeHighlights code snippets and prints them to the screen.
Hyperlinkce_hyperlinkGenerates a link to another website.
Top linkce_toplinkGenerates a link to jump to the top of the page.
Imagece_imageGenerates a stand-alone image.
Galleryce_galleryGenerates a lightbox image gallery.
Downloadce_downloadGenerates a link to download a file.
Downloadsce_downloadsGenerates multiple links to download files.
Article-Includes another article.
Content element(parent class)Includes another content element.
Formce_formIncludes a form.
Module(parent class)Includes a front end module.
Article teaserce_teaserDisplays the teaser text of an article.
Commentsce_commentsAdds a comment form to an article.

Access control

Each content element can be protected so only guests or members of a particular group can see it on the website.

Protected content element

Flash content

Flash content is a special type of content which is not shown in an article on the website but loaded into a dynamic Flash movie using loadVars(). To allow communitcation between Contao and Flash, you have to add the following function to the root frame of your movie:

TextField.prototype._loadArticle = function(flashID) {
    tf = this;

    // Enable HTML mode and remove content
    tf.html = true;
    tf.htmlText = "";

    // Instantiate a new LoadVars object
    lv = new LoadVars();
    lv["flashID"] = flashID;
    lv.sendAndLoad(URL + "flash.php", lv, "POST");

    lv.onLoad = function(success) {
        if (success) {
            tf.htmlText = lv["content"];
        }
    }
}

// Load the Flash content "myArticle" into the text field "myTextBox"
myTextBox._loadArticle("myArticle");

Importing a style sheet

The following ActionScript allows you to import a style sheet to format a dynamic text field:

TextField.prototype._addCSS = function(style_sheet) {
    tf= this;
    tf.styleSheet = null;

    // Instantiate a new StyleSheet object
    st = new TextField.StyleSheet();
    st.load(URL + style_sheet);

    st.onLoad = function(success) {
        if (success) {
            tf.styleSheet = st;
        }
    }
}

// Add the style sheet "basic.css" to the text box "myTextBox"
myTextBox._addCSS("basic.css");

Note that Flash only supports a small subset of HTML tags, so some of your styles might not display correctly.

Add a comment