Webgenz
  Product Overview News & Events Support

 

Generation Process


Webgenz CMS generates a Project by executing the following steps:
  1. Webgenz CMS reads in the Project Definition File. For each line in the Project Definition File, Webgenz CMS does the following:
     
  2. Webgenz CMS reads the Template File and the Content File(s) referenced on the line.
     
  3. Webgenz CMS processes the Template File one line at a time. As Webgenz CMS finds a Macro reference in the Template File, it searches for the Macro definition in the Content Files.
     
  4. Webgenz CMS searches for the Macro definition by inspecting the Content File(s). It starts by searching the first Content File defined on the line, and then inspects any inherited Content Files, if they exist. As soon as Webgenz CMS finds the Macro definition, it stops searching.
     
  5. Webgenz CMS replaces the Macro reference in the Template File with the value of the Macro.
     
  6. If a Macro definition is not found for the Macro reference (or if the Macro has a blank value) then the entire line in the Template File that includes the Macro reference is deleted. This behavior is usually desirable, however it can be overridden by setting an option on the "Project Properties" screen.
     
  7. Since Macros can be nested, Webgenz CMS will process the Template File repeatedly until no Macro references remain.

Notes:

  • In Step 4 above, it is possible to control the starting point from which Webgenz CMS will search for a Macro definition. For example, it is possible to indicate that Webgenz CMS should start searching for the Macro from an inherited Content File. To do this, a special format is used in the Macro reference. That format is:
         [@^MY_TAG]
         
    The "^" in the Macro reference indicates that Webgenz CMS should start looking for the Macro definition one level up in the hierarchy. This feature provides a way to "subclass" Macros.
     
  • When Webgenz CMS finds a Macro definition, it may alter the Macro's value before it replaces the Macro reference with the Macro value. Why would Webgenz CMS do this? Webgenz CMS does this in order to preserve the formatting of the HTML document that it generates. Here's an example:

    Consider the following Template File:

         <HTML>
         <HEAD>
         <TITLE>My Title</TITLE>
         </HEAD>
         <BODY>
         <TABLE>
           <TR>
             <TD>
               [@MY_CONTENT]
             </TD>
           </TR>
         </TABLE>
         </BODY>
         </HTML>
         

    And the following Content File:

         [@MY_CONTENT]:
         This is a block of content that
         is a few lines long. This is
         just an example.
         [@]
         

    If Webgenz CMS were to simply insert the Macro value in place of the Macro reference, the result would be the following:

         <HTML>
         <HEAD>
         <TITLE>My Title</TITLE>
         </HEAD>
         <BODY>
         <TABLE>
           <TR>
             <TD>
         This is a block of content that
         is a few lines long. This is
         just an example.
             </TD>
           </TR>
         </TABLE>
         </BODY>
         </HTML>
         

    Since the formatting of this output is undesirable, Webgenz CMS will alter the Macro value. Webgenz will add whatever characters appear before and after the Macro reference in the Template file (usually just white space) to each line of the Macro value. In the example above, the output will be as follows:

         <HTML>
         <HEAD>
         <TITLE>My Title</TITLE>
         </HEAD>
         <BODY>
         <TABLE>
           <TR>
             <TD>
               This is a block of content that
               is a few lines long. This is
               just an example.
             </TD>
           </TR>
         </TABLE>
         </BODY>
         </HTML>
         

    As you can see, this formatting is much more desirable and reflects the formatting that the author of the Template File intended. However, this feature can be the source of confusion. To see what I mean, lets assume that the Template File in the example above is the following:

         <HTML>
         <HEAD>
         <TITLE>My Title</TITLE>
         </HEAD>
         <BODY>
         <TABLE>
           <TR>
             <TD>[@MY_CONTENT]</TD>
           </TR>
         </TABLE>
         </BODY>
         </HTML>
         

    In this case, Webgenz CMS will generate the following:

         <HTML>
         <HEAD>
         <TITLE>My Title</TITLE>
         </HEAD>
         <BODY>
         <TABLE>
           <TR>
             <TD>This is a block of content that</TD>
             <TD>is a few lines long. This is</TD>
             <TD>just an example.</TD>
           </TR>
         </TABLE>
         </BODY>
         </HTML>
         

    Obviously, this is very undesirable. However, it is a side effect of the fact that Webgenz CMS is designed to maintain the formatting and indentation that appears in the Template File so that the generated file will have the same formatting that it would have if you were to write it by hand. So, if you find yourself with Webgenz CMS output that you do not understand, just make sure that you place Macro references on lines by themselves.

Copyright 1997-2002. All rights reserved. Webgenz is a trademark. Last updated: Monday, July 22, 2002