Added by Jeroen Reijn, last edited by Arjé Cahn on Feb 06, 2006  (view change)

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.

Defining a layout for your template

The layout file is mainly made up of

  • structural widgets (grid, group, row, cell, etc)
  • presentational widgets (textfield, dropdown, htmlfield, etc)
  • generic (non-visible) constructs like macro, template, display, etc.

How does it work?

Some commonly used definition elements are:

Name Attributes Descripion
template   A template for presentation of an element or attribute. The contents of the template represent the context of the element/attribute in the final presentation. If the element is a repeated element, actions on the element should be placed within the element template. Child elements of the element represented by this template should also be contained in this template, or the child templates should be called from here.
  name The name of the template equals the absolute xpath for the element or attribute. E.g."/document/content/bodycontent" or "/document/meta/date/@year".
group   A group is a container element, which child widgets are automatically styled according to the 'type' attribute of the group. For example, the elements can be styled according to "one widget per row, with column 1 containing the label of the widget and column 2 containing the actual widget".
  type The type of the group determines the layout of the child elements of this group.It can have several values like: (columns,column,rows,row,container)

Example:

<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:i18n="http://apache.org/cocoon/i18n/2.1">

  <template name="/">
    <messagewidget class="demoMessages"/>
    <validationwidget class="demoValidationMessages"/>

    <group type="columns">
      <textfield id="/root/title"/>
      <htmlfield id="/root/body" class="myDemoHtmlArea" initFunc="myDemoHtmlArea"/>
    </group>

  </template>

</layout>