I created a helper in the application module, and it works perfectly. When I try to load it from another modules, such as user, it tells me that it can not find the class.
Class 'Application \ View \ Helper \ Footertable' not found
I tried to put this code in module.config.php well as the application module even in the same file of the user module.
'view_helpers' => array (
'invokables' => array (
'footertable' => 'Application\View\Helper\Footertable'
)
),
I think it's a problem autoloading class but I can not find information on how to load this helper when you are in another module
I invoke helper in view file using
$this->footertable()
work perfectly in application module but not in user module
any idea?
Hello, but my code is correct
<?php
namespace Application\View\Helper;
use Zend\View\Helper\AbstractHelper;
class Footertable extends AbstractHelper{
protected $inizioFine;
protected $numero;
public function __invoke($inizioFine,$numero){
$this->inizioFine = $inizioFine;
$this->numero = $numero;
echo sprintf('Mostra %d a %d di %d record',$this->inizioFine['start'],$this->inizioFine['end'],$this->numero);
}
}
the space in config is an copy & past errors. I still have the same problem: can't load helper from another module
update full error
Fatal error: Class 'Application\View\Helper\Footertable' not found in D:\www\httpdocs\test\vendor\zendframework\zendframework\library\Zend\ServiceManager\AbstractPluginManager.php on line 170
path is
D:\www\httpdocs\test\module\Application\src\View\Helper\Footertable.php