0

I'm trying to do ` $partial = array(DIR.'/menu.phtml', 'default');

  echo $this->navigation()->menu()->setPartial($partial);`

and im getting error Fatal error: Zend\View\Exception\RuntimeException: Zend\View\Renderer\PhpRenderer::render: Unable to render template "/home/cawa/www/zf2/module/Nav/view/layout/menu.phtml"; resolver could not resolve to a file in /home/cawa/www/zf2/vendor/zendframework/zendframework/library/Zend/View/Helper/Navigation/AbstractHelper.php on line 471

what is the problem?

Daniel M
  • 3,369
  • 20
  • 30
Cawa
  • 1,269
  • 3
  • 25
  • 44
  • Apparently the file is non existant `/module/Nav/view/layout/menu.phtml` THat's all the error gives you. – Sam Sep 21 '12 at 08:19
  • no the file is there, if theres no such file it gives another error – Cawa Sep 21 '12 at 08:23
  • I'm not sure if the Resolver can handle absolute paths. Try setting it to 'layout/menu.phtml'. If this still won't work, something is wrong with your resolver. In this case, report back to us and we'll check your configuration. **NOTE** that I had a typo in my comment. It has to be "layout/menu.phtml" - not "view/layout/menu.phtml". – Daniel M Sep 21 '12 at 09:16
  • thanks it was about the path, with /layout/menu.phtml it works , can u give me a link fore some examples of partials menu? – Cawa Sep 21 '12 at 09:25
  • These are the docs I use the most (except browsing the sources on my own): http://zf2.readthedocs.org/en/latest/modules/zend.view.helpers.html Hope this helps. – Daniel M Sep 21 '12 at 10:03
  • so theres no difference between $this->partial and this->navigation->menu-setpartial ??? – Cawa Sep 21 '12 at 10:17
  • and how i can combine zend_nagigation and partial? – Cawa Sep 21 '12 at 10:41

2 Answers2

0

Also note about naming of menus - if the "navigation" keyword doesn't exist then container in the partial was empty for me.

<?= $this->navigation()->menu('navigation')->setPartial(array('partials/menu.phtml', 'default'))->render() ?>
Ian Warner
  • 1,058
  • 13
  • 32