include

Runs another LaiRu file and inserts its output at the call site.

Target function

Signature

1include(path::string)

Runs another LaiRu file and inserts its output at the call site.

include is a global callable that can be used wherever an expression is valid. include appears in project setup, source loading, or packaging code. Keep paths explicit, load reusable definitions once, and choose template mode only when literal output is part of the file.

Parameters

path
Required value of type string. Supply path positionally unless the signature shows a keyword form.

Examples

Basic call

1include('/includes/header.lasso')
The example shows the normal call shape. Adapt variable names, validation, and surrounding error handling to the context.

Pass page state into an include

1[2local(page_title) = 'Media Library'3local(active_nav) = 'media'4include('/includes/header.lasso')5]6<main>7  <h1>[#page_title]</h1>8</main>
Includes run in the surrounding request context, so shared templates can read locals set before the include.