문제

like in topic, I have two static method in view helper but when I try to call in controller action by

Zend_View_Helper_SomeHelper::firstStaticMethod();

I got error:

Warning: include_once(Zend/View/Helper/SomeHelper.php): failed to open stream: No such file or directory in /library/Zend/Loader.php on line 134 Warning: include_once(): Failed opening 'Zend/View/Helper/SomeHelper.php' for inclusion (include_path='/application/../library:/library:.:/usr/share/pear:/usr/share/php') in /library/Zend/Loader.php on line 134 Fatal error: Class 'Zend_View_Helper_SomeHelper' not found in /application/modules/default/controllers/Controller.php on line 174

Helper code:

class Zend_View_Helper_SomeHelper extends Zend_View_Helper_Abstract {
    //....//
    public static function firstStaticMethod(){
        //some code hear
    }
    public static function secoundStaticMethod(){
        //some code hear
    }
}

I need to use this method in helpers and action. any ideas?

도움이 되었습니까?

해결책

Can you try this

$viewHelperObj = $this->view->getHelper('SomeHelper');
$viewHelperObj->secoundStaticMethod();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top