The "#include" command allows you to include external files (whole or selected fragments) so this would have to be the simplest and common way of obtaining code reuse and this is where facilities such as SSI (Server Side Includes) stop. PPWIZARD can do much more than this.
Macros are collections of text and/or commands and would have to be one of the most important and most used features of this preprocessor.
The most common ways of creating macros are with these methods:
The simplest types of macro simply allows you to define text which you will use over and over again. You will want to specify it in one place so that if it ever changes you won't need to hunt up all occurances. The following example shows an email address being defined (this would normally be done in a central place and be accessed with #include):
#define MyEmailAddress firstname.lastname@example.org
Now that we have defined the email address (once as per example above), in all the html pages that required it we could refer to it like:
<P>If you have any questions or suggestions for improvements please feel free to <A HREF="mailto:<$MyEmailAddress>">email me</A>.
There are also a number of "Standard Macros" which always exist, these allow you to easily obtain information about the current time or files being generated or included. All sorts of useful information is available in standard formats, if you don't like the format of a particular item such as the "compile time" then it is a simple matter to use ppwizard to create your own format. There are some specialised forms of standard variables as follows:
All normal macros are replaced before standard macros. The "<?xXX>" form is never replaced until just before the line is to be written to the output file.
A macro's name (or parameter) can be very long and can contain nearly any character (space and end of macro replacement character are the main exceptions). Macro names should also not contain the square bracket characters (see macro indirection). You will be told if a macro name is invalid when you try to define it. The maximum length of a macro will be approximately 100 characters in OS/2 rexx and unlimited with the regina interpreter.
The name of a macro (and its parameters) are normally case insensitive, however you can make them case sensitive by using the CsReplacement option. When this option is not used all macros and parameters are converted to upper case.
You now know enough to get started with simple macros which when used along with the "#include" command are powerful facilities for reuse, not only can you reuse all or parts of a file but you can define extremely small items which are too small to put into files of their own (such as email or web addresses).
I recommend that you go on and at least the simplest macros section of the doco. After becoming familiar with ppwizard and its basic features I recommend that all of the advanced sections listed below be read, while it can be a hard slog, understanding these sections can greatly improve the quality of what you can do.
Some more advanced topics follow:
Even more advanced topics: