1. Go to this page and download the library: Download alexoliverwd/brace 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/ */
alexoliverwd / brace example snippets
/** Include brace */
/** New brace instance */
$brace = new Brace\Parser();
/** Set instance variables (Optional) */
$brace->remove_comment_blocks = false;
$brace->template_path = __DIR__.'/';
$brace->template_ext = 'tpl';
/** Process template and echo out */
$brace->Parse('example',[
'name' => [
'first' => 'John',
'last' => 'Doe'
]
]);
/** New brace instance */
$brace = new Brace\Parser();
/** Process template and return string */
$template_string = $brace->Parse('example',[
'name' => [
'first' => 'John',
'last' => 'Doe'
]
], false)->return();
/** New brace instance */
$brace = new Brace\Parser();
/** Process template and compile to external file */
$brace->compile('example', 'example.html', [
'name' => [
'first' => 'John',
'last' => 'Doe'
]
]);
/** New brace instance */
$brace = new Brace\Parser();
/** Process template and echo out */
$brace->Parse('example',[
'firstname' => 'John Doe'
]);
/** New brace instance */
$brace = new Brace\Parser();
/** Process template and echo out */
$brace->Parse('example',[
'names' => ['John','Steve','Bert']
]);
/** New brace instance */
$brace = new Brace\Parser();
/** Process template and echo out */
$brace->Parse('example',[
'names' => ['John','Steve','Bert']
]);
/** New brace instance */
$brace = new Brace\Parser();
/** Process template and echo out */
$brace->Parse('example',[
'names' => ['John','Steve','Bert','Fred','Cindy']
]);
/** New brace instance */
$brace = new Brace\Parser();
/** Process template and echo out */
$brace->Parse('example',[
'names' => [
'name_1' => 'Dave',
'name_2' => 'John',
'name_3' => 'Barry'
]
]);
/** New brace instance */
$brace = new Brace\Parser();
/** Process template and echo out */
$brace->Parse('example',[]);
/** New brace instance */
$brace = new Brace\Parser();
/** Process template and echo out */
$brace->Parse('example',[
'first_name' => 'John',
'last_name' => 'Doe'
]);
/** New brace instance */
$brace = new Brace\Parser();
/** Process template and echo out */
$brace->Parse('example',[
'names' => ['John','Steve','Bert','Fred','Cindy']
]);
/** New brace parser */
$brace = new Brace\Parser();
/** Return HTML link */
$button_function = function ($attributes){
return '<a href="'.$attributes['url'].'" alt="'.$attributes['alt'].'" target="'.$attributes['target'].'" rel="noreferrer noopener">'.$attributes['title'].'</a>';
};
/** Register shortcode */
$brace->regShortcode('button', 'button_function');
/** Process content template */
$brace->Parse('content', []);
// Init brace
$brace = new Brace\Parser();
$brace->template_path = __DIR__.'/';
// Process first template
$brace->Parse('example',[
'name' => [
'first' => 'John',
'last' => 'Doe'
]
]);
// Process second template using the same brace instance
$brace->clear()->parse('example_two',[
'name' => [
'first' => 'Dave',
'last' => 'Smith'
]
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.