ZF2 Custom View Helper problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ZF2 Custom View Helper problem

erkinaka
i have the error below whe i use custom view helper. but it works on local. it doesn't work on far host.

Warning: require_once(/home/webnolog/public_html/sinav/module/Sorubankam\View\Helper\Testhelper.php): failed to open stream: No such file or directory in /home/webnolog/public_html/sinav/vendor/zendframework/zendframework/library/Zend/Loader/ClassMapAutoloader.php on line 138

Fatal error: require_once(): Failed opening required '/home/webnolog/public_html/sinav/module/Sorubankam\View\Helper\Testhelper.php' (include_path='.:/opt/php55/lib/php') in /home/webnolog/public_html/sinav/vendor/zendframework/zendframework/library/Zend/Loader/ClassMapAutoloader.php on line 138



my module.config.php

  'view_helpers' => array(
        'invokables' => array(
            'test_helper' => 'Sorubankam\View\Helper\Testhelper',
        )
    ),



my testhelper

<?php
namespace Sorubankam\View\Helper;
use Zend\View\Helper\AbstractHelper;
 
class Testhelper extends AbstractHelper {
 
public function __invoke($output = 'bar') {
    return "$output , this is ZF2 View Helper";
}
 
}



i need help. thanks now
Reply | Threaded
Open this post in threaded view
|

Re: ZF2 Custom View Helper problem

Marco Pivetta
Hi Erinaka,

On 25 January 2015 at 22:55, erkinaka [via Zend Framework Community] <[hidden email]> wrote:
i have the error below whe i use custom view helper. but it works on local. it doesn't work on far host.

Warning: require_once(/home/webnolog/public_html/sinav/module/Sorubankam\View\Helper\Testhelper.php): failed to open stream: No such file or directory in /home/webnolog/public_html/sinav/vendor/zendframework/zendframework/library/Zend/Loader/ClassMapAutoloader.php on line 138

Fatal error: require_once(): Failed opening required '/home/webnolog/public_html/sinav/module/Sorubankam\View\Helper\Testhelper.php' (include_path='.:/opt/php55/lib/php') in /home/webnolog/public_html/sinav/vendor/zendframework/zendframework/library/Zend/Loader/ClassMapAutoloader.php on line 138



my module.config.php

  'view_helpers' => array(
        'invokables' => array(
            'test_helper' => 'Sorubankam\View\Helper\Testhelper',
        )
    ),



my testhelper

<?php
namespace Sorubankam\View\Helper;
use Zend\View\Helper\AbstractHelper;
 
class Testhelper extends AbstractHelper {
 
public function __invoke($output = 'bar') {
    return "$output , this is ZF2 View Helper";
}
 
}


You probably used an incorrect path where saving a file, like in following example:

src/SoRUbanKAM/View/helper/TESTHELPER.pHp


This works on windows/osx, but will break when using a case-sensitive filesystem (linux, by default).

Consider developing in a VM that reflects your production environment.

Reply | Threaded
Open this post in threaded view
|

Re: ZF2 Custom View Helper problem

erkinaka
This post was updated on .
hi marco,
thanks for your reply.
but i checked the path names and class names they are all ok for case sensitive system.

i am usin samsonik's example on this link 
only the view folder name is different from my project. it is in the same folder but with small capital "view"


and the problem is still going on
Reply | Threaded
Open this post in threaded view
|

Re: ZF2 Custom View Helper problem

erkinaka
In reply to this post by Marco Pivetta
hi i have a mistake about path setup. My view helper folder was in view scripts folder. I moved it src/Sorubankam/View folder. now it is working. Thank you