how to use a ZF2 view helper from within a custom view helper
view-helpers, zend-framework2
Solution
You should use other view helpers inside a custom view helper like below:
$this->view->otherHelper();
Problem
I want to create a custom view helper to reuse a standard set of page links in several view scripts, and I am having trouble getting the urls from routing. The ZF2 url helper `url($name, $urlParams, $routeOptions, $reuseMatchedParams` generates urls from route parameters if it is coded in the view script itself. However, if I place the same code in my custom helper, I get the message: ``` Call to undefined method myCustomHelperPath::url() ``` I understand that there are controller plugins to get the url from the routing, but I’m trying to get the url in a view helper, not a controller. In my case, I want to use a ZF2 view helper from within my custom view helper.