|Format: <defenv TagName [ FormalParameterlist ] > heitml </defenv>|
|Format: <defenv TagName [ FormalParameterlist ] >< inherit ClassName1, ... > heitml </defenv>|
Purpose: The defenv tag defines a method (format 1) or class (format 2) that can be called by an environment tag, i.e. an HTML/XML like element with a content and an end tag or an empty element tag. The defenv tag can contain any mixture of HTML and heitml Tags including the special defbody tag.
When a tag named TagName occurs within a page, the body of the defenv tag is called and executed. As soon as the defbody tag is reached, the content of the TagName tag is called. defbody can be called zero, one, or many times.
The content of the call has the same local variables as the procedure containing the environment call. Using the defbody Tag inside the source code of the environment calls the content. Therefore defbody can so be used several times at any place inside the defenv, also within a loop or within other environments.
Unless defautoclose is used, the actual call must have an end-tag (e.g. <br>..</br>) or must be an empty- element-tag.(e.g. <br/>).
If there are multiple definitions for the same TagName, the textually last definition is active.
Parameter passing and redefinitions work as described in Methods. Output parameters are copied to the caller, each time the content is called and when the environment finally returns.
See Also: For a description of the inherit tag, see the inherit tag.
For example, environments are useful for defining Web Page layouts, etc. that control the "look and feel" of an application or module. A sample environment definition is as follows:
<defenv BODY> <ShowLogo> <ShowSlogan> <defbody> <ShowEmailAddress> <ShowCopyrightMessage> </defenv>
Now that the environment has been defined, it can be called as follows:
<BODY> <Procedure1> <Procedure2> <ProcedureN> </BODY>
When the environment is called as in the above example, it begins by issuing
calls to the
then continues by executing Procedures1,2,N which are called automatically by
the defbody Tag contained
within the environment definition. After the last Procedure has been
executed, the environment issues calls to the
<ShowCopyrightMessage> procedures before exiting.
|Note: The defenv Tag is Case Sensitive, which means heitml will not recognize it if you use capital letters (e.g. <DEFENV IdName>).|