jaxon-php/jaxon-latte

Jaxon view renderer for the Latte template engine

v3.0.0 2019-12-05 08:24 UTC

This package is auto-updated.

Last update: 2022-05-05 14:08:48 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.