PHP code example of volta-framework / component-template
1. Go to this page and download the library: Download volta-framework/component-template 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/ */
volta-framework / component-template example snippets
use Volta\Component\Templates\Template as View
// Set the Base Directory globally
// Note: In Volta all directory references ends with a slash
View::setBaseDir('/path/to/templates/directory/');
// Create a view with basic placeholders
$view = new View('layout.phtml', [
'title' => 'Unknown page'
]);
// add placeholders using the set function
$view->set('description', 'A simple home page')
// or use array access
$view['keywords'] = 'home, simple';
// add the template for the content and overwrite some off the parents
// placeholders
$view->addSubTemplate('content', 'content.phtml', ['title' => 'Contact'])
// render the view
echo $view;