|
|
|
Content files define the values of Macros.
Here is a sample of a Content File:
[@TITLE]:
Welcome to Webgenz
[@]
[@BODY_CONTENT]:
Welcome to Webgenz, the web site generation utility. The program is designed to
help you build and maintain web sites more efficiently than ever before.
[@]
Notes:
- The Macro Value is contained within start and end tags. The start tag is the Macro Tag itself followed by ":". The
end tag is [@]. The end tag must appear on a line by itself. The specific characters used in the Macro Tags
are configurable using the program "Options" screen.
- Additional Macro Tags may appear within a Macro Value. In other words, Macro Tags can be nested.
Replacement of the Macro Tags will happen as expected. The level of nesting needs to be set in the program
"Options" screen.
- IMPORTANT To preserve the format of the generated HTML Document, each line of a multi-line Macro Value will be
prefaced with whatever text (typically white space) appears to the left of the Macro Tag in the Template
File. If there is HTML code to the left of a Macro Tag in a Template File, the Macro Value should be
a single-line value, unless you intend to prefix each line of the Macro Value with this HTML code. Accordingly,
it is usually best to place a Macro Tag on its own line in a Tempate File -- unless you are sure that the Macro Value
is only a single-line value. (Read more)
Advanced Topics:
- "Inheritance" is a core concept in Webgenz. When Webgenz attempts to replace a Macro Tag with a Macro Value, Webgenz will
first look to see if the Macro is defined in the primary Content File. If it is not defined in the primary Content File,
Webgenz will search through the content file hierarchy looking for the definition of the Macro.
- It is possible to "subclass" Macros. For example, a Global Content File might contain a Macro called
[@JAVA_SCRIPT]
which contain a block of Java Script code that should be available to any Document in the Project. A primary Content File
can define its own [@JAVA_SCRIPT] Macro as follows:
[@JAVA_SCRIPT]:
some JavaScript code
[@^JAVA_SCRIPT]
[@]
The last line of this Macro Value is a Macro Tag that references the same Macro Tag, but the "^" indicates that Webgenz
should start looking for the Macro Value starting from the Parent Content File.
- Parameters can be passed into Macro Values. A Macro that takes Parameters is defined as follows:
[@MY_MACRO(@a:1)(@b:2)(@c)]:
This Macro prints the values (@a), (@b), and (@c).
The Parameters "a" and "b" have default values, the Parameter "c" does not.
[@]
This Macro defines three Parameters: "a", "b", and "c". The Parameters "a" and "b" are defined with the default values "1" and "2".
This Macro can be referenced in a Template File in any of the following ways:
[@MY_MACRO] - When referenced without any Parameters, the default values for the
Parameters are used.
[@MY_MACRO(@a:Yes)(@b:No)(@c:Maybe)] - When referenced with Parameters, the
values passed into the Macro will be substituted for the Parameters in the Macro.
[@MY_MACRO(@c:Maybe)(@b:No)(@a:Yes)] - The order of Parameters is not important. Parameters
are referenced by name, not position.
[@MY_MACRO(@a:Yes)] - Parameters are optional. If a value is not supplied for
a Parameter, the default value will be used. If no defalut value is provided, the Parameter is replaced with blank space.
|