PHP code example of andrew72ru / bitrix-twig

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

    

andrew72ru / bitrix-twig example snippets


$arCustomTemplateEngines['twig'] = [
    'templateExt' => ['twig', 'html.twig'],
    'function'    => 'renderTwigTemplate'
];

'debug' => false,
'charset' => 'utf-8',
'cache' => $_SERVER['DOCUMENT_ROOT'] . '/bitrix/cache/twig',
'auto_reload' => $this->request->get('clear_cache') ? 'Y' === strtoupper($this->request->get('clear_cache')) : false,
'autoescape' => false,

// bitrix/.settings.php



return [
    // skip
    'twigRenderer' => [
        'value' => [
            'debug' => true,
        ]
    ],
    // skip
];