1. Go to this page and download the library: Download coercive/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/ */
coercive / template example snippets
use Coercive\Utility\Template\ArrayLoader;
# ArrayLoader returns multiple template, so if only one we take it by using [0] (the first row in array).
$template = ArrayLoader::load([$mapped])[0] ?? null;
# If you need to use some methods based on a map system, you have to load maps by using automap method.
if($template) {
$template->automap();
}
# Render the template
echo $template->getHtml();
# See constant options on top of the class.
echo $template->getInternalId();
echo $template->getInternalClass();
echo $template->getInternalNamespace();
echo $template->getInternalType();
echo $template->data()->get('something');
foreach ($template->getPositionByType('custom') as $position) {
if($position->data()->get('item_type') === 'SLIDE' && $code = (int) $position->data()->get('item_code')) {
$slide = $$$_Get_Your_Data_Here_For_Example($code);
if($slide) {
$html = $$$_Get_Render_System_Here_For_Example('template/example/slide', ['slide_data' => $slide]);
$position->setWrapper($html); // or setContent() if you have a wrapper to use
}
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.