Macros allow you to define a common bit of text or snippet of HTML in one place, then conveniently use it in many pages by just referring to it by name. This is useful for creating common headers, footers and navigation links on your site without resorting to frames. Adding a macro to a cloaked page is simple:
<MACRO Header>
The contents of the macro, of course, will be inserted in the page just as if they were part of the file. By defining common text or HTML in a macro, you need only update it in one place and every instance will be automatically updated. This allows you page design flexibility that would otherwise be a maintenance nightmare.
Macros can contain text, HTML and even other NetCloak commands. Combining HTML and NetCloak commands to make dynamic macros can be tremendously powerful.
Macros can be defined one of two ways: either as part of the special NetCloak.macros file (in the NetCloak Files folder on the server), or as separate text files on the server. Defining macros in the NetCloak.macros file is helpful because it keeps all of your macros in the same place. It has the added advantage of caching all of the macros in RAM.
Here is a sample macro as it would be defined in the NetCloak.macros file:
<BEGIN_MACRO Header>
<BODY BGCOLOR=white>
<CENTER><IMG SRC="/Images/HeaderGraphic.gif" HEIGHT=152 WIDTH=480>
<P>
<A HREF="index.html">Home</A> |
<A HREF="search.html">Search</A> |
<A HREF="about.html">About</A>
</CENTER>
<END_MACRO>
Note the <BEGIN_MACRO>, with the macro's name at the beginning and "Header" and the <END_MACRO> at the end of the macro. These specify the beginning and end of each macro since the NetCloak.macros file may have many different macros in it.
With this header macro defined, updating the navigation links, changing the backgroud or replacing the header graphic only requires changing the macro.
You can also use the MACRO command to insert text or HTML from separate files on the server into your pages. This can be useful for inserting larger amounts of text, or for inserting text that will be changed frequently or is produced by another application on the server. Just specify a file name instead of the name of a macro defined in the NetCloak.macros file.