Render content from string/database and generate links with twig

前端 未结 3 1077
孤街浪徒
孤街浪徒 2020-12-09 23:30

Because of several reasons including translation of content i had to build a simple CMS to render the pages of my Symfony2 application.

My problem now is, that is se

3条回答
  •  醉酒成梦
    2020-12-10 00:18

    Symfony 2.7 makes this easy from PHP, too:

        $twig = $this->get('twig');
        $template = twig_template_from_string($twig, 'Hello, {{ name }}');
        $output = $template->render(['name' => 'Bob']));
    

提交回复
热议问题