我得到了编辑页面的工作。现在我可以看到渲染和显示的页面,但我找不到可以使用它的模板。
呈现页面的控制器:
return $this->render('FEBundle:Public\Impressum:Impressum.html.twig',array());
那么如何从渲染文件中获取路径?
答案 0 :(得分:1)
可能在FEBundle/Resources/views/Public/Impressum/Impressum.html.twig
答案 1 :(得分:0)
从Symfony 2.7开始,您可以使用Twig探查器:http://symfony.com/blog/new-in-symfony-2-7-twig-profiler
答案 2 :(得分:0)
Referencing Templates in a Bundle
Referencing Templates in a Bundle - overriding-bundle-templates
模板应该在:
app/Resources/FEBundle/views/Public/Impressum/Impressum.html.twig
或在:
FEBundle/Resources/views/Public/Impressum/Impressum.html.twig
编辑:
如果您想要来自控制器的服务器路径:
$parser = $this->container->get('templating.name_parser');
$locator = $this->container->get('templating.locator');
$path = $locator->locate($parser->parse('FEBundle:Public\Impressum:Impressum.html.twig'));