PHP code example of upfactor / sim

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

    

upfactor / sim example snippets



оздаем объект шаблонизатора
$sim = new \Sim\Sim();

//Путь до директории с шаблонами
$sim->setRootPath('/templates/');

//Путь до директории хранения кеш-файлов
$sim->setCachePath('/cache/');

//Создаем массив данных
$data = array(
    'title' => 'Employee phone numbers',
    'people' => array(
        array('name' => 'Alex', 'phone' => '+12132775504'),
        array('name' => 'William', 'phone' => '+12132102192'),
        array('name' => 'Daniel', 'phone' => '+12136402431')
    )
);

//Выполняем обработку шаблона
$sim->execute('my_template_file.html', $data);​