Closed wiktor-obrebski closed 10 years ago
Still getting this error?
Hey. Yes. I investigated this and found exactly situation. And now I am not sure that is a problem with zfctwig or zfcuser.
I use ZfcTwig and ZfcUser together. I changed default ZfcUser templates to my own twig templates. https://github.com/ZF-Commons/ZfcUser/wiki/How-to-override-built-in-view-scripts I use twig hierarchy style, so I setted disable_zf_model to true. In this case (if I use zfctwig in version above 1.0.3) zend trying to load "layout/layout" template - although I never use that path in my project.
I trying this on empty project, only with zfcuser and zfcwig - and got this same problem. If you will try reproduce it do not forget about deleting default '../layout/layout.phtml' file.
Can you show an example of the view scripts?
It can be simples script with twig inheritance, in my test I use this:
...view/layout/layout-test.twig:
<html>
<body>
LAYOUT:
{% block body %}{% endblock %}
</body>
</html>
...view/zfc-user/user/login.twig:
{% extends "layout-test" %}
{% block body %}
<p>test login</p>
{% endblock %}
And my viewmanager configuration:
'view_manager' => array(
...
'template_map' => array(
'layout-test' => __DIR__ . '/../view/layout/layout-test.twig',
...
),
...
),
This is enough to reproduce bug. I use zfcuser in "dev-master" version. When I downgrade zfctwig to 1.0.3 above code work properly. Any higher version produce bug:
Fatal error: Uncaught exception 'Zend\View\Exception\RuntimeException' with message 'Zend\View\Renderer\PhpRenderer::render: Unable to render template "layout/layout"; resolver could not resolve to a file' in /home/psychowico/apache-sites/test/vendor/zendframework/zendframework/library/Zend/View/Renderer/PhpRenderer.php on line 499
Seems like layout/layout is still trying to be rendered and shouldn't be. I'll take a look. Thanks.
@psychowico How do you set up main viewmodel template?
Add in controller this line:
$this->layout('layout-test');
By default it set up to 'layout/layout' and it can throw such exception.
You have to modify the view_manager properties in the Application config. Review the default module.config.php in the ZendSkeletonApplication for more information.
@vnagara So, I use "disable_zf_model" options not to setting additional things in any existing controller. In twig I should can set my layout template by this: {% extends "layout-test" %}
@spiffyjr I not have idea what do u mean. I show you short example of my view manager configuration. I have it setted similar like in ZendSkeletonApplication - in test application it was almost identical.
I had this problem as well, but finally resolved it by meticulously reviewing/debugging the view_manager settings. In short, this works if you're careful about setting it up correctly.
Reopen if this is still an issue.
In version 1.1.0 and later I getting this error:
"Zend\View\Renderer\PhpRenderer::render: Unable to render template "layout/layout"; resolver could not resolve to a file"
I have 'disable_zf_model' flag setted to true. I have not any file defined for "layout/layout" template map.