PHP code example of jsangrador / phptal-view

1. Go to this page and download the library: Download jsangrador/phptal-view 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/ */

    

jsangrador / phptal-view example snippets


use Slim\Views\PhpTalRenderer;

ner = $app->getContainer();
$container['renderer'] = new PhpTalRenderer("./templates");

$app->get('/hello/{name}', function ($request, $response, $args) {
    return $this->renderer->render($response, "/hello.html", $args);
});

$app->run();

//Construct the View
$phpView = new PhpTalRenderer("./path/to/templates");

//Render a Template
$response = $phpView->render(new Response(), "/path/to/template.html", $yourData);