Chapter 3. Basic Syntax

Table of Contents

Escaping From HTML
Comments
Hyperlinks
Dynamic Hyperlink Translation
Including Header Files

Escaping From HTML

When an RSP page executes its content is sent verbatim in the response until it encounters the special tag <% which denotes the beginning of a code section. The contents of this tag, up to the closing tag %>, are parsed as RSP language statements and executed sequentially.

Example 3.1. Escaping HTML

In the code:

Hello, world!
<% print("This is a section of code"); %>
This is more literal HTML or whatever.
<%= "This expression gets printed as if by print()" %>

the output produced would be:

Hello, world!
This is a section of code
This is more literal HTML or whatever.
This expression gets printed as if by print()

You should note the following points:

  • In RSP, as in C, Java, PHP, JSP, Perl and many other langauges, language statements are separated by semicolons ;.
  • If a code tag is followed by an equals sign (i.e. <% =) then the contents of that code section is interpreted as a single expression and should not end with a semicolon. The expression will be evaluated at run time and printed in the response.
  • If there is only whitespace between the final code end tag (%>) and the end of the file then it is omitted from the output. Whitespace is defined as any character with an ASCII value of less than or equal to 32 (e.g. spaces, tabs, newlines and control characters).