Include(path, [template]) Last updated: 16. May 2023

Include a file or template into another page.

Parameters

Name Type Description
path string Absolute path of file to include.
template (optional) string If referring to a Docly document with a schema that include templates.
You can specify what template it should generate.

Returns

The contents of a file, if a HASH file the executed result of the file.
If the file is not found a message with "Include template '....' failed!

Example

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
<html>
    <head>
        <title>Test</title>
    </head>
    <body>
        #include("#/Test-header.html")#
        <article>
            Content here ...
            #include("Frontpage", "Article.html")#
        </article>
        #include("#/Test-footer.html")#
    </body>
</html>

Output

The #JS code above produces the output shown below:
<html>
    <head>
        <title>Test</title>
    </head>
    <body>
        This is content placed in the file Test-header.html.
        <article>
            Content here ...
            Unknown file Frontpage
        </article>
        Test-footer.html file contents.
    </body>
</html>