PHP code example of jaxon-php / jaxon-latte

1. Go to this page and download the library: Download jaxon-php/jaxon-latte library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jaxon-php / jaxon-latte example snippets


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

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

// /path/to/demo/views/sub/dir/file.latte

<!-- In page header -->
{jxnCss()}
</head>

<body>

<!-- Page content here -->

</body>

<!-- In page footer -->
{jxnJs()}

{jxnScript()}

    <div class="col-md-12" {jxnBind($rqAppTest)}>
        {jxnHtml($rqAppTest)}
    </div>

    <div class="col-md-12" {jxnPagination($rqAppTest)}>
    </div>

    <select class="form-select"
        {jxnOn('change', $rqAppTest->setColor(jq().val()))}>
        <option value="black" selected="selected">Black</option>
        <option value="red">Red</option>
        <option value="green">Green</option>
        <option value="blue">Blue</option>
    </select>

    <button type="button" class="btn btn-primary"
        {jxnClick($rqAppTest->sayHello(true))}>Click me</button>

    <div class="row" {jxnEvent([
        ['.app-color-choice', 'change', $rqAppTest->setColor(jq().val())]
        ['.ext-color-choice', 'change', $rqExtTest->setColor(jq().val())]
    ])}>
        <div class="col-md-12">
            <select class="form-control app-color-choice">
                <option value="black" selected="selected">Black</option>
                <option value="red">Red</option>
                <option value="green">Green</option>
                <option value="blue">Blue</option>
            </select>
        </div>
        <div class="col-md-12">
            <select class="form-control ext-color-choice">
                <option value="black" selected="selected">Black</option>
                <option value="red">Red</option>
                <option value="green">Green</option>
                <option value="blue">Blue</option>
            </select>
        </div>
    </div>
json
""jaxon-php/jaxon-latte": "^5.0"
}