symfony - Twig Loader prependPath not working -
i'm trying use theme in symfony 2.5.6 following tutorial : http://www.ahmed-samy.com/symofny2-twig-multiple-domains-templating/
so tried in templatelistener (declared service)
$path = dirname(__dir__) . '/resources/themes/' . $theme . '/views'; $this->twig->getloader()->prependpath($path, 'mywebsitefront');
but not work, template "mywebsitefront:index:index.html.twig" not found (but exists @ c:\www\mywebsitefront\src\mywebsitefront\resources\themes\mytheme\views\index\index.html.twig, path generated $path)
any ideas ?
according the docs, when render template need reference namespace aliased path e.g.
@mywebsitefront/index/index.html.twig
when using setpaths(), addpath(), , prependpath() methods, specify namespace second argument (when not specified, these methods act on "main" namespace):
$loader->addpath($templatedir, 'admin'); namespaced templates can
accessed via special @namespace_name/template_path notation:
$twig->render('@admin/index.html', array());
note: namespace not required.
Comments
Post a Comment