Answer the question
In order to leave comments, you need to log in
How to get given in array in twig?
Good evening, I ran into such a problem, I run the Twig template engine:
$loader = new \Twig_Loader_Filesystem('/view/');
$twig = new \Twig_Environment($loader);
$json = $twig->render('login.twig', array('form' => $params));
{
block: form.attributes.method,
content: "Hello"
}
An exception has been thrown during the rendering of a template ("Unexpected keyword at line 2 column 9
block: form.attributes.m
Answer the question
In order to leave comments, you need to log in
Found the solution :) Stupid mistake of course...
{
block: "{{form.attributes.method}}",
content: "Hello"
}
this is the first time I see that a template engine is used like this
Those. Are you using a template engine to output JSON?
I do not argue, a nail can be hammered with an electron microscope, but .. why?
You saw, for example, this:
php.net/manual/ru/function.json-encode.php
https://github.com/kherge-php/json
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question