Tmplz Tags |
Include Tags: ShowThe Show tag "shows" a Section from an included template. It must always appear inside of an Include tag. Consider the following template, in a file named "list.html", which provides a basic HTML unordered list: <ul> [$Section Item]<li>[$Slot Value]</li>[$Section] </ul> Using the above template, the next template uses Show and Fillin tags to create a list: [$Include list.html] [$Show Item] [$Fillin Value]First value.[$Fillin] [$Show] [$Show Item] [$Fillin Value]Second value.[$Fillin] [$Show] [$Include] The result looks like this: <ul> <li>First Value.</li> <li>Second Value.</li> </ul> Note how the original Section is shown twice; after the first Show, additional Shows cause the Section to append a copy of itself to itself. Also note the use of nested Fillin tags; the Show tag can contain any tag that an Include tag may contain, i.e. Fillin, Rename, Remove, and even Show itself. Consider the following example, where Section x2 rests within Section x1 in x.html: [$Include x.html] [$Show x1] [$Show x2/] [$Show] [$Show x1] [$Show x2/][$Show x2/] [$Show] [$Include] Self-closing Show TagsObviously if a Show element contains nested tags, a closing Show tag is needed. When there are no nested tags, however, it is annoying to have to type a closing tag; therefore a Show can close itself using a "/" (just like XML and HTML): [$Include x.html] [$Show Foo/] [$Include] This syntax cannot be used with any other tags; the parser can already recognize whether they are self-closing without the "/" hint. Order of Show statementsAs is the case with Fillin, the order of Show tags does not have to match the order of Section tags in the included document. For example, this: [$Include x.html] [$Show A/][$Show B/] [$Include] does the same thing as this (B,A instead of A,B): [$Include x.html] [$Show B/][$Show A/] [$Include] Show does not "destroy" the SectionUnlike the Fillin tag, which "destroys" its corresponding Slot, the Show tag leaves the original Section intact so that it can be shown again later. To remove a Section, use the Remove tag. "Deep" ShowsThis works very similar to deep Fillins. Example: [$Include x.html] [$Show x1.x2/] [$Include] In the above example, Section x2 is shown, but x1 is not, on the assumption that something else will show x1 later on. Contrast this behavior with the earlier example of nested show tags, where both Section x1 & x2 become visible; here, only Section x2 is visible, and only after x1 is shown by something else. Next page: Rename |