Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

Block and inline elements

A block element always begins on a new line when displayed. It exists in its own virtual box and is always followed by a carriage return (like if someone hit the "Enter" key after typing in some text). There are 12 types of block elements:

  • Headings
  • Numbered lists
  • Bullet lists
  • List items
  • Embedded objects
  • Literal text
  • Tables
  • Table rows
  • Table header cells
  • Table cells
  • Paragraphs
  • Block custom tags

An inline element becomes the part of other text in a natural way. There is no box around inline elements and it doesn't look like if someone hit the "Enter" key after typing it in. There are 6 types of inline elements:

  • Bold text
  • Italic text
  • Hyperlinks
  • Anchors
  • Lines
  • Inline custom tags

Block elements are represented by block-level tags in the resulting XHTML code, inline elements are represented by inline tags. Because of this there are two main rules for block and inline elements.

XHTML

eZ Publish XML (Online Editor)

Placing text or other inline tags directly within the "body" tag is not allowed. They should be surrounded by a block level tag.

Text and/or inline elements are always encapsulated by a paragraph (you can see the tag "p" in the OE status bar, but note that the paragraph tags are not shown in the simplified XML). Please note that text or inline elements inside table cells are encapsulated by paragraphs both in eZ Publish XML and resulting XHTML. Text or inline elements inside block custom tags are also encapsulated by paragraphs.

Block-level tags may contain inline tags inside but not the other way around. For example, a paragraph tag can not be placed inside a bold tag.

Block elements may contain inline elements but not the other way around. For example, if you select two paragraphs and click the "Bold" button, the OE will create two bold elements (one inside each paragraph).

Please note that a single "p" tag inside a table cell will be omitted in the resulting XHTML code if you add the following line into the "[ezxhtml]" section of an override for the "settings/ezxml.ini" configuration file:

RenderParagraphInTableCells=disabled

Svitlana Shatokhina (15/12/2005 8:29 am)

Svitlana Shatokhina (15/02/2006 1:15 pm)

Svitlana Shatokhina, Balazs Halasy


Comments

  • Insert inline JavaScript scripts into the content

    A little tip in the hope that it will be useful...

    For a site, I needed to insert JavaScript statements to be parsed and not displayed by the browser, on a page-by-page basis. So I configured a <script> custom tag of an inline type into the content.ini file of the admin and the public siteacceses:

    AvailableCustomTags[]=script
    IsInline[script]=true
    


    Then, I created a template file in the \templates\content\datatype\view\ezxmltags\ directory (of the site's design), called script.tpl, with this code:

    <script type="text/javascript" language="javascript">
    {$content}
    </script>
    


    This worked fine. There is no need to wrap the $content variable within {literal} operators; there won't be any trouble using JavaScript curly braces ('{', '}').

    The custom tag *must* be of an inline type, or else a parse error will be triggered by the engine, because block tags are printed between <p> tags, so the result would be like:

    <script><p>{JavaScript code}</p></script>.