You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

Counters

The concept of counters in Structr is very similar to the counters in LaTeX. Counters are a numbering mechanism for nested objects, like chapters, lists etc. In Structr, counters allow you to create an automatic numbering of subsequent elements in an HTML page or document.

Counters are often used in conjunction with Repeater Elements.

Normally, a user would do something like this:

<h1>Chapter ${inc_counter(1, true)}${get_counter(1)}</h1>
<h2>Section ${inc_counter(2)}${get_counter(1)}.${get_counter(2)}</h2>
<h2>Section ${inc_counter(2)}${get_counter(1)}.${get_counter(2)}</h2>
<h1>Chapter ${inc_counter(1, true)}${get_counter(1)}</h1>
<h2>Section ${inc_counter(2)}${get_counter(1)}.${get_counter(2)}</h2>
<h2>Section ${inc_counter(2)}${get_counter(1)}.${get_counter(2)}</h2>

which results in the following output:

Chapter 1

Section 1.1

Section 1.2

Chapter 2

Section 2.1

Section 2.2

Search results for "Counters"

Create Nodes

If you select Create node, you will see a select box with a list of target types to choose from. The importer will create a new node of the selected type whenever it encounters a matching XML element in the input document. If the XML element has attributes, you can assign a target attribute from the selected type, like originId for the CustomerID attribute.