INCLUDE

INCLUDE lets you include other files in a program file. The file name is specified as parameter; you may also use an expression. Paths may include directory data in the format customary in AFP. Otherwise files are searched relative to the .afp or .afpa document that is currently being compiled:

*!<[INCLUDE: "%root%\includes\footer.htm"]>

If the INCLUDE command is used inside a <%...%> block it automatically terminates that block. If the file to be included also contains script code, that code must be re-initiated through <%...%>. This rule ensures that even pure HTML files may be included. If a file included through the INCLUDE command is modified, all pages where this file is included are regarded as having been modified. At the next invocation the pages will be re-compiled.

INCLUDE is particularly suited for the inclusion of components that are the same in different pages. You may for instance set up an AFP document that is made up of a single <TABLE> command and displays the current table through a SCAN loop. The same applies to footers, identically laid-out headers and blocks with meta information.

Since INCLUDE can also be used to include PRG files this is a handy method for the inclusion of programs of your desktop applications in the Web application without having to fumble with SET PROCEDURE TO or to stop the AFP Service to modify the procedure file. The inclusion of program files in the .code file by way of INCLUDE lets program files automatically benefit from the versioning mechanism that AFP runs to avoid access conflicts after modifications.