Including Header Files

It is common when writing web applications to keep commonly used definitions and HTML in header files. You can include the text of a header file into an RSP program using the include and requires statements. The difference between the two is that requires will not re-include a file that has already been included earlier in the program.

The suggested naming convention for header files is to use a file extension of .rsph.

Example 3.4. Inclusion Example

This is a simple program which makes use of an HTML header template in header.rsph and definitions contained in definitions.rsph:

// This file is included here.
include "header.rsph";

// This file is only included if it has not already been included.
requires "definitions.rsph";

Hello world, the answer is <%=ANSWER%>.


This is header.rsph:

    <title>An HTML Page</title>

This is definitions.rsph:

const int ANSWER = 42;