I wrote a partial which I want to use in several modules. I thought the best way would be to put it into my custom library.
But unfortunately I couldn't figure out a way to include this partial without using a very ugly path like:
echo $this->partial('/../../../../vendor/myvendor/library/MyVendor/View/Views/FormPartial.phtml'
, array(...));
Any ideas how to link to my vendor directory from my view?
The problem is the resolver can't resolve the path of the view template you had provided. I usually add a configuration entry for all accessible partials in the template_map entry in the module.config.php
for example I have header and footer partials like this my view/layout/header.phtml and view/layout/footer.phtml
below is my config
and inside my layout view script I simply put
and
Another if you have your partials under /module/controller/action format you can also do
you should place the view script in the view folder of your module's controller folder