I have a problem relation with twig template.
final class index {
public $request;
private $loader;
private $twig;
/**
* Constructor.
* definition : class preloader with default
* symfony component request class
* twig template configuration
* @param type dependency injection and function
*/
public function __construct(){
//get request info
$this->request=new request();
$this->loader = new \Twig_Loader_Filesystem(root.'/src/declarations/twigTemplate');
$this->twig = new \Twig_Environment($this->loader, array(
//'cache' => root.'/src/declarations/twigTemplate/cache',
));
}
/**
* get declaration main function.
* definition:index method is defined in a declaration
* and it is called as https://ip/company/service/app/service/doc
* @param type dependency injection and function
* @return array
*/
public function index(){
//return
return $this->twig->render("index.twig",['var'=>'foo']);
}
}
my twig file outputs as same html codes.namely,it doesn't run html codes.
index.twig file :
<strong>{{ var }}</strong>
output :
<strong>foo</strong>
I can solve this problem.already thanks for your answers