After the output from the view or units has been created, it is simply included in the template:




    $nav = new nav();
    $nav->link_add('/', 'Home');

<!DOCTYPE html>
<html id="<?= html($response->page_id_get()) ?>" lang="<?= html($response->lang_get()) ?>" xml:lang="<?= html($response->lang_get()) ?>" xmlns="http://www.w3.org/1999/xhtml">

    <?= $response->head_get_html(); ?>


    <header id="page_header" role="banner">
        <p><img src="/a/img/logo.png" alt="Site Logo" /></p>

    <nav id="page_navigation" role="navigation">
        <?= $nav->html(); ?>

    <main id="page_content" role="main">
        <?= $response->view_get_html(); ?>

    <?= $response->foot_get_html(); ?>


The $response->head_get_html(); will add the following:

And then anything else you have added with $response->head_add_html();

Note that these <script> tags are added with:

$response->js_add('/a/js/js-loading.js', 'async', 'head');


Like in views, if the controller sets a variable, such as:

$response = response_get();
$response->set('name', 'value');

Then it can also be used in the template ctp file, e.g.

<?= html($name) ?>

The $response variable is also available by default.

Response object

The response object provides a few methods, the 3 most important are:



The last 2 will return the necessary HTML for the CSS, JavaScript, etc.