jaxon-php/jaxon-latte

Jaxon view renderer for the Latte template engine

v4.0.2 2022-08-18 04:38 UTC

This package is auto-updated.

Last update: 2024-11-04 06:44:33 UTC


README

Render views with the Latte template engine in Jaxon applications.

Installation

Install this package with Composer.

"require": {
    "jaxon-php/jaxon-latte": "~3.0"
}

Usage

Foreach directory containing Latte templates, add an entry to the app.views section in the configuration.

    'app' => [
        'views' => [
            'demo' => [
                'directory' => '/path/to/demo/views',
                'extension' => '.latte',
                'renderer' => 'latte',
            ],
        ],
    ],

In the application classes, this is how to render a view in this directory.

class MyClass extends \Jaxon\CallableClass
{
    public function action()
    {
        $this->response->html('content-id', $this->view()->render('demo::/sub/dir/file'));
        return $this->response;
    }
}

Read the documentation to learn more about views in Jaxon applications.