Tmplz Template API

Tmplz Tags

Include Tags: Fillin

A Fillin "fills in" a Slot in an included template. A Fillin is always nested within an Include, and it always has both a starting and closing tag. Consider the following template, named "formletter.html":

    The International Society of Software Problems
    Somewhere, NH, USA 45678
    [$Slot Date]:
    Greetings, [$Slot Person]:
      We are writing to inform you that your software is giving us a headache. 
      Please stop doing that, [$Slot Person].
    Best Wishes,
    Us

The next template includes formletter.html and fills in its Slots:

    [$Include ./formletter.html]
      [$Fillin Person]Mr. Difficult[$Fillin]
      [$Fillin Date]June 12, 2045[$Fillin]
    [$Include]
    P.S. This time we mean it.

- and so we get:

    The International Society of Software Problems
    Somewhere, NH, USA 45678
    June 12, 2045
      
    Hello there, Mr Difficult:
      We are writing to inform you that your software is giving us a headache. 
      Please stop doing that, Mr. Difficult.
    Best Wishes,
    Us
    P.S. This time we mean it.

Fillin order doesn't have to match Slot order

In the prior example, the Slots "Date" & "Greeting" appear respectively, but the Fillins appear in the opposite order. This is perfectly okay.

Allowable Sub-Tags

A Fillin basically acts as a template unto itself, so it can contain all the same kinds of tags. This is a powerful feature since it means a Fillin can be used to insert a complex template inside the included contents of another template.

Fillins "Destroy" Slots

A Fillin causes Slots to become "static", so that a given Slot can only be filled in only once; of course this rule does not affect other templates that Include the same content, since (as noted elsewhere) Include tags only affect the copy of the included template, not the original.

"Deep" Fillins

Recall that Slots can be nested inside of Sections. Sometimes we want to fill in a nested Slot on the assumption that something else will show the Section later on. To do this, the Fillin supplies a list of nested Sections and a final Slot, separated by period (".") characters. For example:

    [$Include xyz.html]   
      [$Fillin X1.X2.X3.YYY]Blah[$Fillin]   
    [$Include]

Here, when xyz.html is included, the parser will look for: Slot YYY inside Section X3 inside Section X2 inside Section X1... and fill it in with "Blah". So xyz.html ought to look something like this:

    [$Section X1] 1 ...
      [$Section X2] 2 ...
        [$Section X3] 3 ...
          [$Slot YYY]
        [$Section]
      [$Section]
    [$Section]

Note that if we want to fill a Slot that actually has a "." character in its name, the name can be quoted to prevent misinterpretation:

    [$Include xyz.html]   
      [$Fillin "A.Slot.Name"]Etc.[$Fillin]   
      [$Fillin S1.S2."A.Section.Name"."Another.Slot.Name"]Blah[$Fillin]   
    [$Include]

Next page: Show