Search code examples
htmltwigtwig-extension

Skip html line in Twig


I have not used Twig before and now rise wit problem that I need skip full line in twig as it is

My html is

<h4 class="title">{{ 'publish' | translate }}</h4>

In my index

require_once('lib/Twig/Autoloader.php');
Twig_Autoloader::register();

$loader = new Twig_Loader_Filesystem('views');

$twig = new Twig_Environment($loader, array(
    //'cache' => 'cache',
    'auto_reload' => true
));

When I render html I get Twig error because of translate. I need advice how to tell twig skip these line as it is not to change any symbol in my html (maybe with tag "translate")


Solution

  • add fake filter translate

    $twig->addFilter(new Twig_SimpleFilter('translate', function($v) {return $v;}));