The <{set}> Directive
Small pieces of content can be set from within other content chunks or
<out> sections using the <set> directive. The format is
<{set name="value"}>
This can be useful to set small chunks of text, by including a <{set}> directive in the content item that uses them.
For example, a common use of <{set}> is to define, ahead of
time, what text should be inserted into a template:
<{set template_body="${foo.txt}"}>
${bar_template}
Note: Order of Content Reference Processing
The processing of content references starts at each <out> URL in turn, and descends from the chunk of text
defined for that file, replacing each ${content_ref} and $(url_ref) one-by-one, in a depth-first manner.
Finally, the tree-traversal starts again from the chunk of <out> text,
searching for $[deferred_content
refs].
Therefore if you wish to <{set}> a variable, let's say x, in a chunk
of content that will not be loaded before x is accessed, you should use
a $[deferred content ref] to
access it.
How <{set}> Relates To Meta-data
The <{set}> directive was implemented before metadata was, and initially
provided a way to do similar things, such as substitute page titles, etc.
Now, however, it's probably better to use <wmmeta> tags to
handle data that is associated with a content-item. Using <wmmeta> tags
means your pages will be able to take advantage of new features, like index
and site-map generation.
The <{set}> directive is retained as a way of quickly setting content
items from within other content, in case this feature proves useful for other
purposes.
|