1. Go to this page and download the library: Download zkwbbr/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/ */
zkwbbr / view example snippets
use Zkwbbr\View;
$data = [
'title' => 'My Title',
'heading' => 'My Heading',
'body' => 'My Body'
];
$view = (new View\View)
->setData($data)
->setLayoutFile('myLayout')
->setTemplateVar('templateContent')
->setTemplateDir(__DIR__ . '/myTemplates/')
->setTemplate('myView')
->setBacktraceIndex(0) // # of nested calls relative to render(); for auto-detecting template file (try 0 first then increment until you find it)
->setStripStringFromTemplateFile('foo') // optional, remove string from template file (e.g., if your controller is the basis for auto template detection e.g., UserControllerIndex, and your actual template file is UserIndex, use 'Controller' as value here)
->render(); // you can also use generatedView() to return the generated view instead of outputting it
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.