Tmplz Template API

Tmplz Tags

Include Tags: Rename

Occasionally it is useful to change the names of Slot & Section tags in an included template. The Rename tag does this, and so it only appears inside of Include elements. Example:

  [$Include foo.html]
    [$Rename Section X XX]
    [$Rename Slot Y YY]
  [$Include]

The template above assumes that foo.html has a top-level Section named X and a top-level Slot named Y, and renames them to XX & YY respectively. The original foo.html is unaffected; the changes are only made to the copy included into the current template. Templates that include the current template have to use the new names to refer to the renamed tags.

"Slot" and "Section" Are Optional

A Rename tag does not have to specify whether it is renaming a Slot or Section. As a matter of fact, a single Rename tag can rename both. For example:

  [$Include foo.html]
    [$Rename X Y]
  [$Include]

Given the above template, if foo.html looks like this:

  [$Section X]Here is some text.[$Section]
  [$Slot X]

- then the effective result is:

  [$Section Y]Here is some text.[$Section]
  [$Slot Y]

Order of Rename tags

As with Fillin and Show, Rename tags do not have to appear in the same order as the Slots and Sections they rename. The Rename does affect the Show & Fillin tags after it, however:

  [$Include x.html]
    [$Show A/]
    [$Fillin B]Hello[$Fillin]
    [$Rename Section A AA]
    [$Rename Slot    B BB]
    [$Show AA/]
    [$Fillin BB]Hello again[$Fillin]
  [$Include]

"Deep" Renames

This works much like deep Fillins and Shows. To rename a Section or Slot that is buried several levels deep within a template, just separate the parent tags with "." characters:

  [$Rename Slot S1.S2.S3.S4 Excellent]

In the above example, S1, S2 & S3 are Sections, and S4 is a Slot; S4 will be renamed to "Excellent".

Next page: Rename