{pad}

A tag with no behaviour of its own: its content renders once, or per row with data=, carrying the generic options.

Pages and execution Tag pairs

Syntax

{pad} ... {/pad}
{pad data='store', name='rows'} ... {/pad}
{pad $name = 'value'} ... {/pad}
{pad} ... {/pad | upper}

Description

{pad}...{/pad} is the plainest tag there is: it returns TRUE and does nothing else, so its content renders once. It exists as a carrier for what every tag can do - data=, content=, name=, level variables, pipes, the handling options and properties - on a tag that adds no meaning of its own.

With data='store' the content repeats once per row of that data, and name= gives the level a name for its properties: {current@rows}. Variables assigned on the tag - {pad $who = 'world'} - exist inside it and are gone after the closing tag. A pipe on the closing tag, {/pad | upper}, works on the whole rendered content.

pad is also what the pad: type prefix names: {pad:if} is the built-in {if} even where the application has a tag of that name. A {pad} is the natural wrapper when a block of template needs options but no data tag fits.

Examples

A carrier for data=

With data= the content renders once per row, under the name the tag is given.

Templateexamples/pad/1-data.pad
{data 'colours'}["red", "green", "blue"]{/data}
<ul>
  {pad data='colours', name='colour'}
    <li>{current@colour}: {$colours}</li>
  {/pad}
</ul>
Resultopen alone
  • 1: red
  • 2: green
  • 3: blue

A scope and a pipe

Variables assigned on the tag live inside it; a pipe on the closing tag works on the whole output.

Templateexamples/pad/2-scope.pad
{pad $who = 'world', $times = 2}
  Hello {$who}, {$times} times.
{/pad | upper}
Resultopen alone
HELLO WORLD, 2 TIMES.

See also

  • {data} Turns its content - JSON, XML, YAML, CSV, a list or a range - into a named data set for a later tag to iterate.
  • {content} Keeps a piece of template under a name instead of printing it, for a later {name} to render.
  • {code} Runs its content as PAD source in a separate engine pass and outputs what that pass produced.
  • {set} Assigns one or more variables, as globals that outlive the level the tag stands in.