Invoking Latch

When creating a standalone PHP page that needs access to Latch, include latch.php:

<?php

require_once $_SERVER["DOCUMENT_ROOT"] . "/" . (LATCH_PATH ?? "") . "/latch.php";

After this file is loaded, Latch initializes the session, database, cache, extensions, events, and shortcodes.

The CMS also provides lib/pages/basic.php, which is useful for rendering a complete page with arbitrary content:

<?php

$args = [];
$args["page_title"] = "My Custom Page";
$args["content"] = "<p>My custom HTML</p>";

Latch\File\ext_part_include(part: "pages/basic.php", args: $args);

Use Latch\File\ext_part_include() instead of a direct include when the file should respect extension overrides.