Content wraps for componentsΒΆ

You can wrap content in components. The child elements of a component instance can be referenced with the _children descriptor of the template context.

Referencing the child contents of the grid component with the _children descriptor in a components file:

%namespace base=doonx.org/base
*grid6633:
  div.ym-grid:
    div.ym-g66.ym-gl:
      div.ym-gbox-left:
        {_children[0]}
    div.ym-g33.ym-gr:
      div.ym-gbox-right:
        {_children[1]}

Usage of the grid component with child contents:

%import components.zml
base-grid6633:
  div.content:
    p: left content
  div.content:
    p: right content

The rendered result:

<div class="ym-grid" >
  <div class="ym-g66 ym-gl" >
    <div class="ym-gbox-left" >
      <div class="content" >
        <p>left content</p>
      </div>
    </div>
  </div>
  <div class="ym-g33 ym-gr" >
    <div class="ym-gbox-right" >
      <div class="content" >
        <p>right content</p>
      </div>
    </div>
  </div>
</div>