Skip to content

0.9.x Field

Andrea Campi edited this page Oct 17, 2012 · 1 revision

Fields

WARNING: this page is based on Treesaver 0.9.x.

Content

Sometimes, a Grid will re-use a portion of content across all pages in a design, such as a running article title across all pages. HTML5 Microdata can be used to define values which can then be used by templates. The example below defines the title variable for use in templates:

  <div itemscope>
    <h1 itemprop="title">Dog <em>Bites</em> Man</h1>
  </div>

The HTML5 itemprop is used to specify the name of the variable; the value is the text of the element, in this case "Dog Bites Man" (note that HTML tags are stripped.) See the Microdata Values specification for details.

Grid

To reference a field value within a template, use data binding (the same as the ToC and Chrome:)

  <span data-bind="title">Backup Text</span>

The data-bind attribute is used to specify which field should be used (as specified by the itemprop attribute).

If no field by the given name is found, then the element will not be modified. This can be used to provide backup content.

Clone this wiki locally