Myna File Include Tutorial

One of the most common tasks in scripting languages is to include a file within another file. Myna provides this as well with a couple of different options.
You can use one of the following:

Myna.include('path'); - Standard include normally used for including executing .js .sjs or .ejs file inside the current thread.

Myna.includeText('path'); - This function will include a text file. You can do this with the standard include to if you wanted.

Myna.includeOnce('path'); - You can use this function to be sure you only include a file once in a request. This can be handy if you have several includes in a request.

Myna.includeContent('path'); - This function can be used to execute a file and capture the returned content instead of including the file.

Be sure to check out MynaPath for all of your options for deriving your path to the included file.

Here is a simplistic example for including a files in the same directory:

<%
Myna.include('top.ejs');
%>
Hello World!
<%
Myna.include('bottom.ejs');
%>

Some of the functions include more options. See Myna.sjs for more details.