Action Helpers not found

16 messages Options
Embed this post
Permalink
asagala

Action Helpers not found

Reply Threaded More More options
Print post
Permalink
Hi,

Cant seem to get my Action Helpers to be discovered by Zend. I have read a couple of articles but still cant seem to get them to work.

i have this line in the Bootstrap.php

Zend_Controller_Action_HelperBroker::addPrefix('Helper');

My file structure is like this
App\
 --library\
 ----Helper\
   ------Helper_DateTimezone.php

Class definition is like this
class Helper_DateTimezone extends Zend_Controller_Action_Helper_Abstract

Also checked that the library folder was in my path with this function get_include_path();

Anyone have a clue.
weierophinney

Re: Action Helpers not found

Reply Threaded More More options
Print post
Permalink
-- asagala <[hidden email]> wrote
(on Sunday, 25 October 2009, 06:32 AM -0700):

> Cant seem to get my Action Helpers to be discovered by Zend. I have read a
> couple of articles but still cant seem to get them to work.
>
> i have this line in the Bootstrap.php
>
> Zend_Controller_Action_HelperBroker::addPrefix('Helper');
>
> My file structure is like this
> App\
>  --library\
>  ----Helper\
>    ------Helper_DateTimezone.php
>
> Class definition is like this
> class Helper_DateTimezone extends Zend_Controller_Action_Helper_Abstract
>
> Also checked that the library folder was in my path with this function
> get_include_path();

You need to inform the autoloader about the "Helper_" namespace. Since
you're clearly using Zend_Application, you can do this in your
configuration file. Add the following:

   autoloaderNamespaces[] = "Helper_"

or, if using an XML configuration:

    <autoloaderNamespaces>Helper_</autoloaderNamespaces>

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
asagala

Re: Action Helpers not found

Reply Threaded More More options
Print post
Permalink
Added autoloaderNamespaces[] = "Helper_" to my application.ini file but still no success. I still get that the Action Helper is not found


Here is my bootstrap.php file

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function _initAutoload()
    {
        $moduleLoader = new Zend_Application_Module_Autoloader(array(
            'namespace' => '',
            'basePath'  => APPLICATION_PATH));
        return $moduleLoader;            
       
//        require_once 'Zend/Loader.php';
//        Zend_Loader::registerAutoload();

    require_once 'Zend/Loader/Autoloader.php';
                $loader = Zend_Loader_Autoloader::getInstance();
                //$loader->setFallbackAutoloader(true);
                //$loader->suppressNotFoundWarnings(false);
                $loader->registerNamespace('Helpers_');
   
        Zend_Session::start();      
       
      Zend_Controller_Action_HelperBroker::addPrefix('Helper');

                $db = Zend_Db::factory($config->db->adapter,$config->db->config->toArray());
                Zend_Db_Table::setDefaultAdapter($db);
                Zend_Registry::set('db', $db);
               
                // setup controller
                $frontController = Zend_Controller_Front::getInstance();
               
                $writer = new Zend_Log_Writer_Firebug();
                $logger = new Zend_Log($writer);
                Zend_Registry::set('logger',$logger);

    }
   
    protected function _initViewHelpers()
    {
        $this->bootstrap('layout');
        $layout = $this->getResource('layout');
        $view = $layout->getView();        
       
        Zend_Dojo::enableView($view);  
       
                $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
                $viewRenderer->setView($view);


        $view->doctype('XHTML1_STRICT');
        $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
        $view->headTitle()->setSeparator(' - ');
        $view->headTitle('NurturLead');
    }
 
}

and my application.ini

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
phpSettings.date.timezone = "UTC"

includePaths.library = APPLICATION_PATH "/../library"

autoloaderNamespaces[] = "Helper_"

bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.layout.layoutpath = APPLICATION_PATH "/layouts"

weierophinney wrote:
-- asagala <asagala@gmail.com> wrote
(on Sunday, 25 October 2009, 06:32 AM -0700):
> Cant seem to get my Action Helpers to be discovered by Zend. I have read a
> couple of articles but still cant seem to get them to work.
>
> i have this line in the Bootstrap.php
>
> Zend_Controller_Action_HelperBroker::addPrefix('Helper');
>
> My file structure is like this
> App\
>  --library\
>  ----Helper\
>    ------Helper_DateTimezone.php
>
> Class definition is like this
> class Helper_DateTimezone extends Zend_Controller_Action_Helper_Abstract
>
> Also checked that the library folder was in my path with this function
> get_include_path();

You need to inform the autoloader about the "Helper_" namespace. Since
you're clearly using Zend_Application, you can do this in your
configuration file. Add the following:

   autoloaderNamespaces[] = "Helper_"

or, if using an XML configuration:

    <autoloaderNamespaces>Helper_</autoloaderNamespaces>

--
Matthew Weier O'Phinney
Project Lead            | matthew@zend.com
Zend Framework          | http://framework.zend.com/
weierophinney

Re: Action Helpers not found

Reply Threaded More More options
Print post
Permalink
-- asagala <[hidden email]> wrote
(on Sunday, 25 October 2009, 09:45 AM -0700):

>
> Added autoloaderNamespaces[] = "Helper_" to my application.ini file but still
> no success. I still get that the Action Helper is not found
>
>
>
> weierophinney wrote:
> >
> > -- asagala <[hidden email]> wrote
> > (on Sunday, 25 October 2009, 06:32 AM -0700):
> > > Cant seem to get my Action Helpers to be discovered by Zend. I have read
> > > a
> > > couple of articles but still cant seem to get them to work.
> > >
> > > i have this line in the Bootstrap.php
> > >
> > > Zend_Controller_Action_HelperBroker::addPrefix('Helper');
> > >
> > > My file structure is like this
> > > App\
> > >  --library\
> > >  ----Helper\
> > >    ------Helper_DateTimezone.php

Here's the other problem. Just call the file "DateTimezone.php", but
inside it, have it define the class "Helper_DateTimezone".


> > > Class definition is like this
> > > class Helper_DateTimezone extends Zend_Controller_Action_Helper_Abstract
> > >
> > > Also checked that the library folder was in my path with this function
> > > get_include_path();
> >
> > You need to inform the autoloader about the "Helper_" namespace. Since
> > you're clearly using Zend_Application, you can do this in your
> > configuration file. Add the following:
> >
> >    autoloaderNamespaces[] = "Helper_"
> >
> > or, if using an XML configuration:
> >
> >     <autoloaderNamespaces> Helper_</autoloaderNamespaces>
> >
> > --
> > Matthew Weier O'Phinney
> > Project Lead            | [hidden email]
> > Zend Framework          | http://framework.zend.com/
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Action-Helpers-not-found-tp26047888p26049606.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
asagala

Re: Action Helpers not found

Reply Threaded More More options
Print post
Permalink
Tried that. It doesnt work.


weierophinney wrote:
-- asagala <asagala@gmail.com> wrote
(on Sunday, 25 October 2009, 09:45 AM -0700):
>
> Added autoloaderNamespaces[] = "Helper_" to my application.ini file but still
> no success. I still get that the Action Helper is not found
>
>
>
> weierophinney wrote:
> >
> > -- asagala <asagala@gmail.com> wrote
> > (on Sunday, 25 October 2009, 06:32 AM -0700):
> > > Cant seem to get my Action Helpers to be discovered by Zend. I have read
> > > a
> > > couple of articles but still cant seem to get them to work.
> > >
> > > i have this line in the Bootstrap.php
> > >
> > > Zend_Controller_Action_HelperBroker::addPrefix('Helper');
> > >
> > > My file structure is like this
> > > App\
> > >  --library\
> > >  ----Helper\
> > >    ------Helper_DateTimezone.php

Here's the other problem. Just call the file "DateTimezone.php", but
inside it, have it define the class "Helper_DateTimezone".


> > > Class definition is like this
> > > class Helper_DateTimezone extends Zend_Controller_Action_Helper_Abstract
> > >
> > > Also checked that the library folder was in my path with this function
> > > get_include_path();
> >
> > You need to inform the autoloader about the "Helper_" namespace. Since
> > you're clearly using Zend_Application, you can do this in your
> > configuration file. Add the following:
> >
> >    autoloaderNamespaces[] = "Helper_"
> >
> > or, if using an XML configuration:
> >
> >     <autoloaderNamespaces> Helper_</autoloaderNamespaces>
> >
> > --
> > Matthew Weier O'Phinney
> > Project Lead            | matthew@zend.com
> > Zend Framework          | http://framework.zend.com/
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Action-Helpers-not-found-tp26047888p26049606.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>

--
Matthew Weier O'Phinney
Project Lead            | matthew@zend.com
Zend Framework          | http://framework.zend.com/
asagala

Re: Action Helpers not found

Reply Threaded More More options
Print post
Permalink
Got it to work by going through all the loading functions using the debugger. ZF was looking for the file in this directory structure

library/
--Zend/
----Controller/
------Action/
--------Helper/
----------DateTimezone.php

Renamed the class to Zend_Controller_Action_Helper_DateTimezone

Everything works but still dont understand why I cant get it working with regular paths.



weierophinney wrote:
-- asagala <asagala@gmail.com> wrote
(on Sunday, 25 October 2009, 09:45 AM -0700):
>
> Added autoloaderNamespaces[] = "Helper_" to my application.ini file but still
> no success. I still get that the Action Helper is not found
>
>
>
> weierophinney wrote:
> >
> > -- asagala <asagala@gmail.com> wrote
> > (on Sunday, 25 October 2009, 06:32 AM -0700):
> > > Cant seem to get my Action Helpers to be discovered by Zend. I have read
> > > a
> > > couple of articles but still cant seem to get them to work.
> > >
> > > i have this line in the Bootstrap.php
> > >
> > > Zend_Controller_Action_HelperBroker::addPrefix('Helper');
> > >
> > > My file structure is like this
> > > App\
> > >  --library\
> > >  ----Helper\
> > >    ------Helper_DateTimezone.php

Here's the other problem. Just call the file "DateTimezone.php", but
inside it, have it define the class "Helper_DateTimezone".


> > > Class definition is like this
> > > class Helper_DateTimezone extends Zend_Controller_Action_Helper_Abstract
> > >
> > > Also checked that the library folder was in my path with this function
> > > get_include_path();
> >
> > You need to inform the autoloader about the "Helper_" namespace. Since
> > you're clearly using Zend_Application, you can do this in your
> > configuration file. Add the following:
> >
> >    autoloaderNamespaces[] = "Helper_"
> >
> > or, if using an XML configuration:
> >
> >     <autoloaderNamespaces> Helper_</autoloaderNamespaces>
> >
> > --
> > Matthew Weier O'Phinney
> > Project Lead            | matthew@zend.com
> > Zend Framework          | http://framework.zend.com/
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Action-Helpers-not-found-tp26047888p26049606.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>

--
Matthew Weier O'Phinney
Project Lead            | matthew@zend.com
Zend Framework          | http://framework.zend.com/

weierophinney

Re: Action Helpers not found

Reply Threaded More More options
Print post
Permalink
In reply to this post by asagala
-- asagala <[hidden email]> wrote
(on Sunday, 25 October 2009, 11:02 AM -0700):
>
> Tried that. It doesnt work.

Is App/library on your include_path?

If it is, and things still aren't working, then you need to send me the
exact code to reproduce it. I just tried the following:

    App/
        Bootstrap.php
        library/
            Helper/
                DateTimezone.php
        configs/
            application.ini
        controllers/
            IndexController.php
        views/
            scripts/
                index.phtml
    public/
        .htaccess
        index.php

In index.php, I define APPLICATION_PATH to point to the 'App' directory
(question: why are you using 'App' and not 'application'?). My
App/configs/application.ini file adds these directives:

    includePaths.library   = APPLICATION_PATH "/library"
    autoloaderNamespaces[] = "Helper_"
    resources.frontcontroller.actionhelperpaths.Helper = APPLICATION_PATH "/library/Helper"

In App/library/Helper/DateTimezone.php, I have the following class:

    class Helper_DateTimezone extends Zend_Controller_Action_Helper_Abstract
    {
    }

I can then grab the helper in my controller:

    class IndexController extends Zend_Controller_Action
    {
        public function indexAction()
        {
            $helper = $this->_helper->getHelper('DateTimezone');
        }
    }

Please make sure that you are following the above directions.

> weierophinney wrote:
> >
> > -- asagala <[hidden email]> wrote
> > (on Sunday, 25 October 2009, 09:45 AM -0700):
> >>
> >> Added autoloaderNamespaces[] = "Helper_" to my application.ini file but
> >> still
> >> no success. I still get that the Action Helper is not found
> >>
> >>
> >>
> >> weierophinney wrote:
> >> >
> >> > -- asagala <[hidden email]> wrote
> >> > (on Sunday, 25 October 2009, 06:32 AM -0700):
> >> > > Cant seem to get my Action Helpers to be discovered by Zend. I have
> >> read
> >> > > a
> >> > > couple of articles but still cant seem to get them to work.
> >> > >
> >> > > i have this line in the Bootstrap.php
> >> > >
> >> > > Zend_Controller_Action_HelperBroker::addPrefix('Helper');
> >> > >
> >> > > My file structure is like this
> >> > > App\
> >> > >  --library\
> >> > >  ----Helper\
> >> > >    ------Helper_DateTimezone.php
> >
> > Here's the other problem. Just call the file "DateTimezone.php", but
> > inside it, have it define the class "Helper_DateTimezone".
> >
> >
> >> > > Class definition is like this
> >> > > class Helper_DateTimezone extends
> >> Zend_Controller_Action_Helper_Abstract
> >> > >
> >> > > Also checked that the library folder was in my path with this
> >> function
> >> > > get_include_path();
> >> >
> >> > You need to inform the autoloader about the "Helper_" namespace. Since
> >> > you're clearly using Zend_Application, you can do this in your
> >> > configuration file. Add the following:
> >> >
> >> >    autoloaderNamespaces[] = "Helper_"
> >> >
> >> > or, if using an XML configuration:
> >> >
> >> >     <autoloaderNamespaces> Helper_</autoloaderNamespaces>
> >> >
> >> > --
> >> > Matthew Weier O'Phinney
> >> > Project Lead            | [hidden email]
> >> > Zend Framework          | http://framework.zend.com/
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Action-Helpers-not-found-tp26047888p26049606.html
> >> Sent from the Zend Framework mailing list archive at Nabble.com.
> >>
> >
> > --
> > Matthew Weier O'Phinney
> > Project Lead            | [hidden email]
> > Zend Framework          | http://framework.zend.com/
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Action-Helpers-not-found-tp26047888p26050238.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
weierophinney

Re: Action Helpers not found

Reply Threaded More More options
Print post
Permalink
In reply to this post by asagala
-- asagala <[hidden email]> wrote
(on Sunday, 25 October 2009, 11:33 AM -0700):

>
> Got it to work by going through all the loading functions using the debugger.
> ZF was looking for the file in this directory structure
>
> library/
> --Zend/
> ----Controller/
> ------Action/
> --------Helper/
> ----------DateTimezone.php
>
> Renamed the class to Zend_Controller_Action_Helper_DateTimezone
>
> Everything works but still dont understand why I cant get it working with
> regular paths.

I've replied to a previous email. You had two issues: the helper was not
on the include path, which would not be an issue if you assocated both a
path *and* prefix when initializing the helper broker. My other email
contains the information you need.


> asagala wrote:
> >
> > Tried that. It doesnt work.
> >
> >
> >
> > weierophinney wrote:
> >>
> >> -- asagala <[hidden email]> wrote
> >> (on Sunday, 25 October 2009, 09:45 AM -0700):
> >>>
> >>> Added autoloaderNamespaces[] = "Helper_" to my application.ini file but
> >>> still
> >>> no success. I still get that the Action Helper is not found
> >>>
> >>>
> >>>
> >>> weierophinney wrote:
> >>> >
> >>> > -- asagala <[hidden email]> wrote
> >>> > (on Sunday, 25 October 2009, 06:32 AM -0700):
> >>> > > Cant seem to get my Action Helpers to be discovered by Zend. I have
> >>> read
> >>> > > a
> >>> > > couple of articles but still cant seem to get them to work.
> >>> > >
> >>> > > i have this line in the Bootstrap.php
> >>> > >
> >>> > > Zend_Controller_Action_HelperBroker::addPrefix('Helper');
> >>> > >
> >>> > > My file structure is like this
> >>> > > App\
> >>> > >  --library\
> >>> > >  ----Helper\
> >>> > >    ------Helper_DateTimezone.php
> >>
> >> Here's the other problem. Just call the file "DateTimezone.php", but
> >> inside it, have it define the class "Helper_DateTimezone".
> >>
> >>
> >>> > > Class definition is like this
> >>> > > class Helper_DateTimezone extends
> >>> Zend_Controller_Action_Helper_Abstract
> >>> > >
> >>> > > Also checked that the library folder was in my path with this
> >>> function
> >>> > > get_include_path();
> >>> >
> >>> > You need to inform the autoloader about the "Helper_" namespace. Since
> >>> > you're clearly using Zend_Application, you can do this in your
> >>> > configuration file. Add the following:
> >>> >
> >>> >    autoloaderNamespaces[] = "Helper_"
> >>> >
> >>> > or, if using an XML configuration:
> >>> >
> >>> >     <autoloaderNamespaces> Helper_</autoloaderNamespaces>
> >>> >
> >>> > --
> >>> > Matthew Weier O'Phinney
> >>> > Project Lead            | [hidden email]
> >>> > Zend Framework          | http://framework.zend.com/
> >>> >
> >>> >
> >>>
> >>> --
> >>> View this message in context:
> >>> http://www.nabble.com/Action-Helpers-not-found-tp26047888p26049606.html
> >>> Sent from the Zend Framework mailing list archive at Nabble.com.
> >>>
> >>
> >> --
> >> Matthew Weier O'Phinney
> >> Project Lead            | [hidden email]
> >> Zend Framework          | http://framework.zend.com/
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Action-Helpers-not-found-tp26047888p26050524.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
asagala

Re: Action Helpers not found

Reply Threaded More More options
Print post
Permalink
When I add these lines

includePaths.library   = APPLICATION_PATH "/library"
autoloaderNamespaces[] = "Helper_"
resources.frontcontroller.actionhelperpaths.Helper = APPLICATION_PATH "/library/Helper"

I get this error
Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'No default controller directory registered with front controller' in C:\Program Files\Zend\ZendServer\share\ZendFramework\library\Zend\Application\Bootstrap\Bootstrap.php

Also I am using applications and not App. Should of typed the whole thing


weierophinney wrote:
-- asagala <asagala@gmail.com> wrote
(on Sunday, 25 October 2009, 11:33 AM -0700):
>
> Got it to work by going through all the loading functions using the debugger.
> ZF was looking for the file in this directory structure
>
> library/
> --Zend/
> ----Controller/
> ------Action/
> --------Helper/
> ----------DateTimezone.php
>
> Renamed the class to Zend_Controller_Action_Helper_DateTimezone
>
> Everything works but still dont understand why I cant get it working with
> regular paths.

I've replied to a previous email. You had two issues: the helper was not
on the include path, which would not be an issue if you assocated both a
path *and* prefix when initializing the helper broker. My other email
contains the information you need.


> asagala wrote:
> >
> > Tried that. It doesnt work.
> >
> >
> >
> > weierophinney wrote:
> >>
> >> -- asagala <asagala@gmail.com> wrote
> >> (on Sunday, 25 October 2009, 09:45 AM -0700):
> >>>
> >>> Added autoloaderNamespaces[] = "Helper_" to my application.ini file but
> >>> still
> >>> no success. I still get that the Action Helper is not found
> >>>
> >>>
> >>>
> >>> weierophinney wrote:
> >>> >
> >>> > -- asagala <asagala@gmail.com> wrote
> >>> > (on Sunday, 25 October 2009, 06:32 AM -0700):
> >>> > > Cant seem to get my Action Helpers to be discovered by Zend. I have
> >>> read
> >>> > > a
> >>> > > couple of articles but still cant seem to get them to work.
> >>> > >
> >>> > > i have this line in the Bootstrap.php
> >>> > >
> >>> > > Zend_Controller_Action_HelperBroker::addPrefix('Helper');
> >>> > >
> >>> > > My file structure is like this
> >>> > > App\
> >>> > >  --library\
> >>> > >  ----Helper\
> >>> > >    ------Helper_DateTimezone.php
> >>
> >> Here's the other problem. Just call the file "DateTimezone.php", but
> >> inside it, have it define the class "Helper_DateTimezone".
> >>
> >>
> >>> > > Class definition is like this
> >>> > > class Helper_DateTimezone extends
> >>> Zend_Controller_Action_Helper_Abstract
> >>> > >
> >>> > > Also checked that the library folder was in my path with this
> >>> function
> >>> > > get_include_path();
> >>> >
> >>> > You need to inform the autoloader about the "Helper_" namespace. Since
> >>> > you're clearly using Zend_Application, you can do this in your
> >>> > configuration file. Add the following:
> >>> >
> >>> >    autoloaderNamespaces[] = "Helper_"
> >>> >
> >>> > or, if using an XML configuration:
> >>> >
> >>> >     <autoloaderNamespaces> Helper_</autoloaderNamespaces>
> >>> >
> >>> > --
> >>> > Matthew Weier O'Phinney
> >>> > Project Lead            | matthew@zend.com
> >>> > Zend Framework          | http://framework.zend.com/
> >>> >
> >>> >
> >>>
> >>> --
> >>> View this message in context:
> >>> http://www.nabble.com/Action-Helpers-not-found-tp26047888p26049606.html
> >>> Sent from the Zend Framework mailing list archive at Nabble.com.
> >>>
> >>
> >> --
> >> Matthew Weier O'Phinney
> >> Project Lead            | matthew@zend.com
> >> Zend Framework          | http://framework.zend.com/
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Action-Helpers-not-found-tp26047888p26050524.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>

--
Matthew Weier O'Phinney
Project Lead            | matthew@zend.com
Zend Framework          | http://framework.zend.com/
weierophinney

Re: Action Helpers not found

Reply Threaded More More options
Print post
Permalink
-- asagala <[hidden email]> wrote
(on Sunday, 25 October 2009, 04:32 PM -0700):

>
> When I add these lines
>
> includePaths.library   = APPLICATION_PATH "/library"
> autoloaderNamespaces[] = "Helper_"
> resources.frontcontroller.actionhelperpaths.Helper = APPLICATION_PATH
> "/library/Helper"
>
> I get this error
> Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception' with
> message 'No default controller directory registered with front controller'
> in C:\Program
> Files\Zend\ZendServer\share\ZendFramework\library\Zend\Application\Bootstrap\Bootstrap.php

You also need the line that defines the controller directory, which is
created by default with zf.sh:

    resources.frontcontroller.controllerDirectory = APPLICATION_PATH "/controllers"

> Also I am using applications and not App. Should of typed the whole thing
>
>
>
> weierophinney wrote:
> >
> > -- asagala <[hidden email]> wrote
> > (on Sunday, 25 October 2009, 11:33 AM -0700):
> >>
> >> Got it to work by going through all the loading functions using the
> >> debugger.
> >> ZF was looking for the file in this directory structure
> >>
> >> library/
> >> --Zend/
> >> ----Controller/
> >> ------Action/
> >> --------Helper/
> >> ----------DateTimezone.php
> >>
> >> Renamed the class to Zend_Controller_Action_Helper_DateTimezone
> >>
> >> Everything works but still dont understand why I cant get it working with
> >> regular paths.
> >
> > I've replied to a previous email. You had two issues: the helper was not
> > on the include path, which would not be an issue if you assocated both a
> > path *and* prefix when initializing the helper broker. My other email
> > contains the information you need.
> >
> >
> >> asagala wrote:
> >> >
> >> > Tried that. It doesnt work.
> >> >
> >> >
> >> >
> >> > weierophinney wrote:
> >> >>
> >> >> -- asagala <[hidden email]> wrote
> >> >> (on Sunday, 25 October 2009, 09:45 AM -0700):
> >> >>>
> >> >>> Added autoloaderNamespaces[] = "Helper_" to my application.ini file
> >> but
> >> >>> still
> >> >>> no success. I still get that the Action Helper is not found
> >> >>>
> >> >>>
> >> >>>
> >> >>> weierophinney wrote:
> >> >>> >
> >> >>> > -- asagala <[hidden email]> wrote
> >> >>> > (on Sunday, 25 October 2009, 06:32 AM -0700):
> >> >>> > > Cant seem to get my Action Helpers to be discovered by Zend. I
> >> have
> >> >>> read
> >> >>> > > a
> >> >>> > > couple of articles but still cant seem to get them to work.
> >> >>> > >
> >> >>> > > i have this line in the Bootstrap.php
> >> >>> > >
> >> >>> > > Zend_Controller_Action_HelperBroker::addPrefix('Helper');
> >> >>> > >
> >> >>> > > My file structure is like this
> >> >>> > > App\
> >> >>> > >  --library\
> >> >>> > >  ----Helper\
> >> >>> > >    ------Helper_DateTimezone.php
> >> >>
> >> >> Here's the other problem. Just call the file "DateTimezone.php", but
> >> >> inside it, have it define the class "Helper_DateTimezone".
> >> >>
> >> >>
> >> >>> > > Class definition is like this
> >> >>> > > class Helper_DateTimezone extends
> >> >>> Zend_Controller_Action_Helper_Abstract
> >> >>> > >
> >> >>> > > Also checked that the library folder was in my path with this
> >> >>> function
> >> >>> > > get_include_path();
> >> >>> >
> >> >>> > You need to inform the autoloader about the "Helper_" namespace.
> >> Since
> >> >>> > you're clearly using Zend_Application, you can do this in your
> >> >>> > configuration file. Add the following:
> >> >>> >
> >> >>> >    autoloaderNamespaces[] = "Helper_"
> >> >>> >
> >> >>> > or, if using an XML configuration:
> >> >>> >
> >> >>> >     <autoloaderNamespaces> Helper_</autoloaderNamespaces>
> >> >>> >
> >> >>> > --
> >> >>> > Matthew Weier O'Phinney
> >> >>> > Project Lead            | [hidden email]
> >> >>> > Zend Framework          | http://framework.zend.com/
> >> >>> >
> >> >>> >
> >> >>>
> >> >>> --
> >> >>> View this message in context:
> >> >>>
> >> http://www.nabble.com/Action-Helpers-not-found-tp26047888p26049606.html
> >> >>> Sent from the Zend Framework mailing list archive at Nabble.com.
> >> >>>
> >> >>
> >> >> --
> >> >> Matthew Weier O'Phinney
> >> >> Project Lead            | [hidden email]
> >> >> Zend Framework          | http://framework.zend.com/
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Action-Helpers-not-found-tp26047888p26050524.html
> >> Sent from the Zend Framework mailing list archive at Nabble.com.
> >>
> >
> > --
> > Matthew Weier O'Phinney
> > Project Lead            | [hidden email]
> > Zend Framework          | http://framework.zend.com/
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Action-Helpers-not-found-tp26047888p26052995.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
asagala

Re: Action Helpers not found

Reply Threaded More More options
Print post
Permalink
I have that line. Here is my full application.ini
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
phpSettings.date.timezone = "UTC"

includePaths.library = APPLICATION_PATH "/../library"

bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"

resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.layout.layoutpath = APPLICATION_PATH "/layouts"

includePaths.library   = APPLICATION_PATH "/library"
autoloaderNamespaces[] = "Helper_"
resources.frontcontroller.actionhelperpaths.Helper = APPLICATION_PATH "/library/Helper"

resources.db.adapter = PDO_MYSQL
resources.db.params.host = localhost
resources.db.params.username = root
resources.db.params.password = aa1aa
resources.db.params.dbname = NurturLead

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1


weierophinney wrote:
-- asagala <asagala@gmail.com> wrote
(on Sunday, 25 October 2009, 04:32 PM -0700):
>
> When I add these lines
>
> includePaths.library   = APPLICATION_PATH "/library"
> autoloaderNamespaces[] = "Helper_"
> resources.frontcontroller.actionhelperpaths.Helper = APPLICATION_PATH
> "/library/Helper"
>
> I get this error
> Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception' with
> message 'No default controller directory registered with front controller'
> in C:\Program
> Files\Zend\ZendServer\share\ZendFramework\library\Zend\Application\Bootstrap\Bootstrap.php

You also need the line that defines the controller directory, which is
created by default with zf.sh:

    resources.frontcontroller.controllerDirectory = APPLICATION_PATH "/controllers"

> Also I am using applications and not App. Should of typed the whole thing
>
>
>
> weierophinney wrote:
> >
> > -- asagala <asagala@gmail.com> wrote
> > (on Sunday, 25 October 2009, 11:33 AM -0700):
> >>
> >> Got it to work by going through all the loading functions using the
> >> debugger.
> >> ZF was looking for the file in this directory structure
> >>
> >> library/
> >> --Zend/
> >> ----Controller/
> >> ------Action/
> >> --------Helper/
> >> ----------DateTimezone.php
> >>
> >> Renamed the class to Zend_Controller_Action_Helper_DateTimezone
> >>
> >> Everything works but still dont understand why I cant get it working with
> >> regular paths.
> >
> > I've replied to a previous email. You had two issues: the helper was not
> > on the include path, which would not be an issue if you assocated both a
> > path *and* prefix when initializing the helper broker. My other email
> > contains the information you need.
> >
> >
> >> asagala wrote:
> >> >
> >> > Tried that. It doesnt work.
> >> >
> >> >
> >> >
> >> > weierophinney wrote:
> >> >>
> >> >> -- asagala <asagala@gmail.com> wrote
> >> >> (on Sunday, 25 October 2009, 09:45 AM -0700):
> >> >>>
> >> >>> Added autoloaderNamespaces[] = "Helper_" to my application.ini file
> >> but
> >> >>> still
> >> >>> no success. I still get that the Action Helper is not found
> >> >>>
> >> >>>
> >> >>>
> >> >>> weierophinney wrote:
> >> >>> >
> >> >>> > -- asagala <asagala@gmail.com> wrote
> >> >>> > (on Sunday, 25 October 2009, 06:32 AM -0700):
> >> >>> > > Cant seem to get my Action Helpers to be discovered by Zend. I
> >> have
> >> >>> read
> >> >>> > > a
> >> >>> > > couple of articles but still cant seem to get them to work.
> >> >>> > >
> >> >>> > > i have this line in the Bootstrap.php
> >> >>> > >
> >> >>> > > Zend_Controller_Action_HelperBroker::addPrefix('Helper');
> >> >>> > >
> >> >>> > > My file structure is like this
> >> >>> > > App\
> >> >>> > >  --library\
> >> >>> > >  ----Helper\
> >> >>> > >    ------Helper_DateTimezone.php
> >> >>
> >> >> Here's the other problem. Just call the file "DateTimezone.php", but
> >> >> inside it, have it define the class "Helper_DateTimezone".
> >> >>
> >> >>
> >> >>> > > Class definition is like this
> >> >>> > > class Helper_DateTimezone extends
> >> >>> Zend_Controller_Action_Helper_Abstract
> >> >>> > >
> >> >>> > > Also checked that the library folder was in my path with this
> >> >>> function
> >> >>> > > get_include_path();
> >> >>> >
> >> >>> > You need to inform the autoloader about the "Helper_" namespace.
> >> Since
> >> >>> > you're clearly using Zend_Application, you can do this in your
> >> >>> > configuration file. Add the following:
> >> >>> >
> >> >>> >    autoloaderNamespaces[] = "Helper_"
> >> >>> >
> >> >>> > or, if using an XML configuration:
> >> >>> >
> >> >>> >     <autoloaderNamespaces> Helper_</autoloaderNamespaces>
> >> >>> >
> >> >>> > --
> >> >>> > Matthew Weier O'Phinney
> >> >>> > Project Lead            | matthew@zend.com
> >> >>> > Zend Framework          | http://framework.zend.com/
> >> >>> >
> >> >>> >
> >> >>>
> >> >>> --
> >> >>> View this message in context:
> >> >>>
> >> http://www.nabble.com/Action-Helpers-not-found-tp26047888p26049606.html
> >> >>> Sent from the Zend Framework mailing list archive at Nabble.com.
> >> >>>
> >> >>
> >> >> --
> >> >> Matthew Weier O'Phinney
> >> >> Project Lead            | matthew@zend.com
> >> >> Zend Framework          | http://framework.zend.com/
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Action-Helpers-not-found-tp26047888p26050524.html
> >> Sent from the Zend Framework mailing list archive at Nabble.com.
> >>
> >
> > --
> > Matthew Weier O'Phinney
> > Project Lead            | matthew@zend.com
> > Zend Framework          | http://framework.zend.com/
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Action-Helpers-not-found-tp26047888p26052995.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>

--
Matthew Weier O'Phinney
Project Lead            | matthew@zend.com
Zend Framework          | http://framework.zend.com/
Hector Virgen

Re: Action Helpers not found

Reply Threaded More More options
Print post
Permalink
I'm not sure how your Bootstrap.php looks, but from the config it appears you don't have the autoloader set up. Here's how I set up mine.

First I add these lines to my application.ini:

; resource plugins
pluginPaths.Default_Resource = APPLICATION_PATH "/resources"

; autoloader
resources.autoloader.namespace = "Default_"
resources.autoloader.basePath = APPLICATION_PATH
resources.autoloader.includeFileCache = APPLICATION_PATH "/../data/pluginLoaderCache.php"
resources.autoloader.fallbackAutoloader = true


Then I add this class to my application in application/resources/Autoloader.php

<?php

/**
 * Default_Resource_Autoloader 
 * 
 * @uses Zend
 * @uses _Application_Resource_ResourceAbstract
 */
class Default_Resource_Autoloader extends Zend_Application_Resource_ResourceAbstract
{
/**
* Defined by Zend_Application_Resource_Resource
*
* @return void
*/
public function init()
{
$options = $this->getOptions();
$autoloader = new Zend_Application_Module_Autoloader(array(
'namespace' => $options['namespace'],
'basePath' => $options['basePath']
));
if (isset($options['fallbackAutoloader']) AND $options['fallbackAutoloader']) {
Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true);
}
if (isset($options['includeFileCache']) AND file_exists($file = $options['includeFileCache'])) {
Zend_Loader_PluginLoader::setIncludeFileCache($file);
}
return $autoloader;
}
}


--
Hector


On Mon, Oct 26, 2009 at 5:54 PM, asagala <[hidden email]> wrote:

I have that line. Here is my full application.ini
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
phpSettings.date.timezone = "UTC"

includePaths.library = APPLICATION_PATH "/../library"

bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"

resources.frontController.controllerDirectory = APPLICATION_PATH
"/controllers"
resources.layout.layoutpath = APPLICATION_PATH "/layouts"

includePaths.library   = APPLICATION_PATH "/library"
autoloaderNamespaces[] = "Helper_"
resources.frontcontroller.actionhelperpaths.Helper = APPLICATION_PATH
"/library/Helper"

resources.db.adapter = PDO_MYSQL
resources.db.params.host = localhost
resources.db.params.username = root
resources.db.params.password = aa1aa
resources.db.params.dbname = NurturLead

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1



weierophinney wrote:
>
> -- asagala <[hidden email]> wrote
> (on Sunday, 25 October 2009, 04:32 PM -0700):
>>
>> When I add these lines
>>
>> includePaths.library   = APPLICATION_PATH "/library"
>> autoloaderNamespaces[] = "Helper_"
>> resources.frontcontroller.actionhelperpaths.Helper = APPLICATION_PATH
>> "/library/Helper"
>>
>> I get this error
>> Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception'
>> with
>> message 'No default controller directory registered with front
>> controller'
>> in C:\Program
>> Files\Zend\ZendServer\share\ZendFramework\library\Zend\Application\Bootstrap\Bootstrap.php
>
> You also need the line that defines the controller directory, which is
> created by default with zf.sh:
>
>     resources.frontcontroller.controllerDirectory = APPLICATION_PATH
> "/controllers"
>
>> Also I am using applications and not App. Should of typed the whole thing
>>
>>
>>
>> weierophinney wrote:
>> >
>> > -- asagala <[hidden email]> wrote
>> > (on Sunday, 25 October 2009, 11:33 AM -0700):
>> >>
>> >> Got it to work by going through all the loading functions using the
>> >> debugger.
>> >> ZF was looking for the file in this directory structure
>> >>
>> >> library/
>> >> --Zend/
>> >> ----Controller/
>> >> ------Action/
>> >> --------Helper/
>> >> ----------DateTimezone.php
>> >>
>> >> Renamed the class to Zend_Controller_Action_Helper_DateTimezone
>> >>
>> >> Everything works but still dont understand why I cant get it working
>> with
>> >> regular paths.
>> >
>> > I've replied to a previous email. You had two issues: the helper was
>> not
>> > on the include path, which would not be an issue if you assocated both
>> a
>> > path *and* prefix when initializing the helper broker. My other email
>> > contains the information you need.
>> >
>> >
>> >> asagala wrote:
>> >> >
>> >> > Tried that. It doesnt work.
>> >> >
>> >> >
>> >> >
>> >> > weierophinney wrote:
>> >> >>
>> >> >> -- asagala <[hidden email]> wrote
>> >> >> (on Sunday, 25 October 2009, 09:45 AM -0700):
>> >> >>>
>> >> >>> Added autoloaderNamespaces[] = "Helper_" to my application.ini
>> file
>> >> but
>> >> >>> still
>> >> >>> no success. I still get that the Action Helper is not found
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> weierophinney wrote:
>> >> >>> >
>> >> >>> > -- asagala <[hidden email]> wrote
>> >> >>> > (on Sunday, 25 October 2009, 06:32 AM -0700):
>> >> >>> > > Cant seem to get my Action Helpers to be discovered by Zend. I
>> >> have
>> >> >>> read
>> >> >>> > > a
>> >> >>> > > couple of articles but still cant seem to get them to work.
>> >> >>> > >
>> >> >>> > > i have this line in the Bootstrap.php
>> >> >>> > >
>> >> >>> > > Zend_Controller_Action_HelperBroker::addPrefix('Helper');
>> >> >>> > >
>> >> >>> > > My file structure is like this
>> >> >>> > > App\
>> >> >>> > >  --library\
>> >> >>> > >  ----Helper\
>> >> >>> > >    ------Helper_DateTimezone.php
>> >> >>
>> >> >> Here's the other problem. Just call the file "DateTimezone.php",
>> but
>> >> >> inside it, have it define the class "Helper_DateTimezone".
>> >> >>
>> >> >>
>> >> >>> > > Class definition is like this
>> >> >>> > > class Helper_DateTimezone extends
>> >> >>> Zend_Controller_Action_Helper_Abstract
>> >> >>> > >
>> >> >>> > > Also checked that the library folder was in my path with this
>> >> >>> function
>> >> >>> > > get_include_path();
>> >> >>> >
>> >> >>> > You need to inform the autoloader about the "Helper_" namespace.
>> >> Since
>> >> >>> > you're clearly using Zend_Application, you can do this in your
>> >> >>> > configuration file. Add the following:
>> >> >>> >
>> >> >>> >    autoloaderNamespaces[] = "Helper_"
>> >> >>> >
>> >> >>> > or, if using an XML configuration:
>> >> >>> >
>> >> >>> >     <autoloaderNamespaces> Helper_</autoloaderNamespaces>
>> >> >>> >
>> >> >>> > --
>> >> >>> > Matthew Weier O'Phinney
>> >> >>> > Project Lead            | [hidden email]
>> >> >>> > Zend Framework          | http://framework.zend.com/
>> >> >>> >
>> >> >>> >
>> >> >>>
>> >> >>> --
>> >> >>> View this message in context:
>> >> >>>
>> >>
>> http://www.nabble.com/Action-Helpers-not-found-tp26047888p26049606.html
>> >> >>> Sent from the Zend Framework mailing list archive at Nabble.com.
>> >> >>>
>> >> >>
>> >> >> --
>> >> >> Matthew Weier O'Phinney
>> >> >> Project Lead            | [hidden email]
>> >> >> Zend Framework          | http://framework.zend.com/
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Action-Helpers-not-found-tp26047888p26050524.html
>> >> Sent from the Zend Framework mailing list archive at Nabble.com.
>> >>
>> >
>> > --
>> > Matthew Weier O'Phinney
>> > Project Lead            | [hidden email]
>> > Zend Framework          | http://framework.zend.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Action-Helpers-not-found-tp26047888p26052995.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>
> --
> Matthew Weier O'Phinney
> Project Lead            | [hidden email]
> Zend Framework          | http://framework.zend.com/
>
>

--
View this message in context: http://www.nabble.com/Action-Helpers-not-found-tp26047888p26070449.html
Sent from the Zend Framework mailing list archive at Nabble.com.


asagala

Re: Action Helpers not found

Reply Threaded More More options
Print post
Permalink
My boothstrap.php is here

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function _initAutoload()
    {
        $moduleLoader = new Zend_Application_Module_Autoloader(array(
            'namespace' => '',
            'basePath'  => APPLICATION_PATH));
        return $moduleLoader;            
       
//        require_once 'Zend/Loader.php';
//        Zend_Loader::registerAutoload();

    require_once 'Zend/Loader/Autoloader.php';
                $loader = Zend_Loader_Autoloader::getInstance();
                //$loader->setFallbackAutoloader(true);
                //$loader->suppressNotFoundWarnings(false);
                $loader->registerNamespace('Helpers_');
   
        Zend_Session::start();      
       
      Zend_Controller_Action_HelperBroker::addPrefix('Helper');

                $db = Zend_Db::factory($config->db->adapter,$config->db->config->toArray());
                Zend_Db_Table::setDefaultAdapter($db);
                Zend_Registry::set('db', $db);
               
                // setup controller
                $frontController = Zend_Controller_Front::getInstance();
               
                $writer = new Zend_Log_Writer_Firebug();
                $logger = new Zend_Log($writer);
                Zend_Registry::set('logger',$logger);

    }
   
    protected function _initViewHelpers()
    {
        $this->bootstrap('layout');
        $layout = $this->getResource('layout');
        $view = $layout->getView();        
       
        Zend_Dojo::enableView($view);  
       
                $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
                $viewRenderer->setView($view);


        $view->doctype('XHTML1_STRICT');
        $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
        $view->headTitle()->setSeparator(' - ');
        $view->headTitle('NurturLead');
    }
 
}

I will try what you suggest tomorrow.


Hector Virgen wrote:
I'm not sure how your Bootstrap.php looks, but from the config it appears
you don't have the autoloader set up. Here's how I set up mine.

First I add these lines to my application.ini:

; resource plugins
pluginPaths.Default_Resource = APPLICATION_PATH "/resources"

; autoloader
resources.autoloader.namespace = "Default_"
resources.autoloader.basePath = APPLICATION_PATH
resources.autoloader.includeFileCache = APPLICATION_PATH
"/../data/pluginLoaderCache.php"
resources.autoloader.fallbackAutoloader = true


Then I add this class to my application in
application/resources/Autoloader.php

<?php

/**
 * Default_Resource_Autoloader
 *
 * @uses Zend
 * @uses _Application_Resource_ResourceAbstract
 */
class Default_Resource_Autoloader extends
Zend_Application_Resource_ResourceAbstract
{
 /**
 * Defined by Zend_Application_Resource_Resource
 *
 * @return void
 */
public function init()
 {
$options = $this->getOptions();
 $autoloader = new Zend_Application_Module_Autoloader(array(
'namespace' => $options['namespace'],
 'basePath' => $options['basePath']
));
 if (isset($options['fallbackAutoloader']) AND
$options['fallbackAutoloader']) {
 Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true);
}
 if (isset($options['includeFileCache']) AND file_exists($file =
$options['includeFileCache'])) {
 Zend_Loader_PluginLoader::setIncludeFileCache($file);
}
 return $autoloader;
}
}


--
Hector


On Mon, Oct 26, 2009 at 5:54 PM, asagala <asagala@gmail.com> wrote:

>
> I have that line. Here is my full application.ini
> [production]
> phpSettings.display_startup_errors = 0
> phpSettings.display_errors = 0
> phpSettings.date.timezone = "UTC"
>
> includePaths.library = APPLICATION_PATH "/../library"
>
> bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
> bootstrap.class = "Bootstrap"
>
> resources.frontController.controllerDirectory = APPLICATION_PATH
> "/controllers"
> resources.layout.layoutpath = APPLICATION_PATH "/layouts"
>
> includePaths.library   = APPLICATION_PATH "/library"
> autoloaderNamespaces[] = "Helper_"
> resources.frontcontroller.actionhelperpaths.Helper = APPLICATION_PATH
> "/library/Helper"
>
> resources.db.adapter = PDO_MYSQL
> resources.db.params.host = localhost
> resources.db.params.username = root
> resources.db.params.password = aa1aa
> resources.db.params.dbname = NurturLead
>
> [staging : production]
>
> [testing : production]
> phpSettings.display_startup_errors = 1
> phpSettings.display_errors = 1
>
> [development : production]
> phpSettings.display_startup_errors = 1
> phpSettings.display_errors = 1
>
>
>
> weierophinney wrote:
> >
> > -- asagala <asagala@gmail.com> wrote
> > (on Sunday, 25 October 2009, 04:32 PM -0700):
> >>
> >> When I add these lines
> >>
> >> includePaths.library   = APPLICATION_PATH "/library"
> >> autoloaderNamespaces[] = "Helper_"
> >> resources.frontcontroller.actionhelperpaths.Helper = APPLICATION_PATH
> >> "/library/Helper"
> >>
> >> I get this error
> >> Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception'
> >> with
> >> message 'No default controller directory registered with front
> >> controller'
> >> in C:\Program
> >>
> Files\Zend\ZendServer\share\ZendFramework\library\Zend\Application\Bootstrap\Bootstrap.php
> >
> > You also need the line that defines the controller directory, which is
> > created by default with zf.sh:
> >
> >     resources.frontcontroller.controllerDirectory = APPLICATION_PATH
> > "/controllers"
> >
> >> Also I am using applications and not App. Should of typed the whole
> thing
> >>
> >>
> >>
> >> weierophinney wrote:
> >> >
> >> > -- asagala <asagala@gmail.com> wrote
> >> > (on Sunday, 25 October 2009, 11:33 AM -0700):
> >> >>
> >> >> Got it to work by going through all the loading functions using the
> >> >> debugger.
> >> >> ZF was looking for the file in this directory structure
> >> >>
> >> >> library/
> >> >> --Zend/
> >> >> ----Controller/
> >> >> ------Action/
> >> >> --------Helper/
> >> >> ----------DateTimezone.php
> >> >>
> >> >> Renamed the class to Zend_Controller_Action_Helper_DateTimezone
> >> >>
> >> >> Everything works but still dont understand why I cant get it working
> >> with
> >> >> regular paths.
> >> >
> >> > I've replied to a previous email. You had two issues: the helper was
> >> not
> >> > on the include path, which would not be an issue if you assocated both
> >> a
> >> > path *and* prefix when initializing the helper broker. My other email
> >> > contains the information you need.
> >> >
> >> >
> >> >> asagala wrote:
> >> >> >
> >> >> > Tried that. It doesnt work.
> >> >> >
> >> >> >
> >> >> >
> >> >> > weierophinney wrote:
> >> >> >>
> >> >> >> -- asagala <asagala@gmail.com> wrote
> >> >> >> (on Sunday, 25 October 2009, 09:45 AM -0700):
> >> >> >>>
> >> >> >>> Added autoloaderNamespaces[] = "Helper_" to my application.ini
> >> file
> >> >> but
> >> >> >>> still
> >> >> >>> no success. I still get that the Action Helper is not found
> >> >> >>>
> >> >> >>>
> >> >> >>>
> >> >> >>> weierophinney wrote:
> >> >> >>> >
> >> >> >>> > -- asagala <asagala@gmail.com> wrote
> >> >> >>> > (on Sunday, 25 October 2009, 06:32 AM -0700):
> >> >> >>> > > Cant seem to get my Action Helpers to be discovered by Zend.
> I
> >> >> have
> >> >> >>> read
> >> >> >>> > > a
> >> >> >>> > > couple of articles but still cant seem to get them to work.
> >> >> >>> > >
> >> >> >>> > > i have this line in the Bootstrap.php
> >> >> >>> > >
> >> >> >>> > > Zend_Controller_Action_HelperBroker::addPrefix('Helper');
> >> >> >>> > >
> >> >> >>> > > My file structure is like this
> >> >> >>> > > App\
> >> >> >>> > >  --library\
> >> >> >>> > >  ----Helper\
> >> >> >>> > >    ------Helper_DateTimezone.php
> >> >> >>
> >> >> >> Here's the other problem. Just call the file "DateTimezone.php",
> >> but
> >> >> >> inside it, have it define the class "Helper_DateTimezone".
> >> >> >>
> >> >> >>
> >> >> >>> > > Class definition is like this
> >> >> >>> > > class Helper_DateTimezone extends
> >> >> >>> Zend_Controller_Action_Helper_Abstract
> >> >> >>> > >
> >> >> >>> > > Also checked that the library folder was in my path with this
> >> >> >>> function
> >> >> >>> > > get_include_path();
> >> >> >>> >
> >> >> >>> > You need to inform the autoloader about the "Helper_"
> namespace.
> >> >> Since
> >> >> >>> > you're clearly using Zend_Application, you can do this in your
> >> >> >>> > configuration file. Add the following:
> >> >> >>> >
> >> >> >>> >    autoloaderNamespaces[] = "Helper_"
> >> >> >>> >
> >> >> >>> > or, if using an XML configuration:
> >> >> >>> >
> >> >> >>> >     <autoloaderNamespaces> Helper_</autoloaderNamespaces>
> >> >> >>> >
> >> >> >>> > --
> >> >> >>> > Matthew Weier O'Phinney
> >> >> >>> > Project Lead            | matthew@zend.com
> >> >> >>> > Zend Framework          | http://framework.zend.com/
> >> >> >>> >
> >> >> >>> >
> >> >> >>>
> >> >> >>> --
> >> >> >>> View this message in context:
> >> >> >>>
> >> >>
> >> http://www.nabble.com/Action-Helpers-not-found-tp26047888p26049606.html
> >> >> >>> Sent from the Zend Framework mailing list archive at Nabble.com.
> >> >> >>>
> >> >> >>
> >> >> >> --
> >> >> >> Matthew Weier O'Phinney
> >> >> >> Project Lead            | matthew@zend.com
> >> >> >> Zend Framework          | http://framework.zend.com/
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >> http://www.nabble.com/Action-Helpers-not-found-tp26047888p26050524.html
> >> >> Sent from the Zend Framework mailing list archive at Nabble.com.
> >> >>
> >> >
> >> > --
> >> > Matthew Weier O'Phinney
> >> > Project Lead            | matthew@zend.com
> >> > Zend Framework          | http://framework.zend.com/
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Action-Helpers-not-found-tp26047888p26052995.html
> >> Sent from the Zend Framework mailing list archive at Nabble.com.
> >>
> >
> > --
> > Matthew Weier O'Phinney
> > Project Lead            | matthew@zend.com
> > Zend Framework          | http://framework.zend.com/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Action-Helpers-not-found-tp26047888p26070449.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>
asagala

Re: Action Helpers not found

Reply Threaded More More options
Print post
Permalink
In reply to this post by Hector Virgen
I tried the above. Still no luck. My Action Helpers still cant be found. I know the Helpers work because when I place them in library\Zend\Controller\Action\Helper. They are found. For some reason I cant get them to get found elsewhere even after trying all of the above.


Hector Virgen wrote:
I'm not sure how your Bootstrap.php looks, but from the config it appears
you don't have the autoloader set up. Here's how I set up mine.

First I add these lines to my application.ini:

; resource plugins
pluginPaths.Default_Resource = APPLICATION_PATH "/resources"

; autoloader
resources.autoloader.namespace = "Default_"
resources.autoloader.basePath = APPLICATION_PATH
resources.autoloader.includeFileCache = APPLICATION_PATH
"/../data/pluginLoaderCache.php"
resources.autoloader.fallbackAutoloader = true


Then I add this class to my application in
application/resources/Autoloader.php

<?php

/**
 * Default_Resource_Autoloader
 *
 * @uses Zend
 * @uses _Application_Resource_ResourceAbstract
 */
class Default_Resource_Autoloader extends
Zend_Application_Resource_ResourceAbstract
{
 /**
 * Defined by Zend_Application_Resource_Resource
 *
 * @return void
 */
public function init()
 {
$options = $this->getOptions();
 $autoloader = new Zend_Application_Module_Autoloader(array(
'namespace' => $options['namespace'],
 'basePath' => $options['basePath']
));
 if (isset($options['fallbackAutoloader']) AND
$options['fallbackAutoloader']) {
 Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true);
}
 if (isset($options['includeFileCache']) AND file_exists($file =
$options['includeFileCache'])) {
 Zend_Loader_PluginLoader::setIncludeFileCache($file);
}
 return $autoloader;
}
}


--
Hector


On Mon, Oct 26, 2009 at 5:54 PM, asagala <asagala@gmail.com> wrote:

>
> I have that line. Here is my full application.ini
> [production]
> phpSettings.display_startup_errors = 0
> phpSettings.display_errors = 0
> phpSettings.date.timezone = "UTC"
>
> includePaths.library = APPLICATION_PATH "/../library"
>
> bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
> bootstrap.class = "Bootstrap"
>
> resources.frontController.controllerDirectory = APPLICATION_PATH
> "/controllers"
> resources.layout.layoutpath = APPLICATION_PATH "/layouts"
>
> includePaths.library   = APPLICATION_PATH "/library"
> autoloaderNamespaces[] = "Helper_"
> resources.frontcontroller.actionhelperpaths.Helper = APPLICATION_PATH
> "/library/Helper"
>
> resources.db.adapter = PDO_MYSQL
> resources.db.params.host = localhost
> resources.db.params.username = root
> resources.db.params.password = aa1aa
> resources.db.params.dbname = NurturLead
>
> [staging : production]
>
> [testing : production]
> phpSettings.display_startup_errors = 1
> phpSettings.display_errors = 1
>
> [development : production]
> phpSettings.display_startup_errors = 1
> phpSettings.display_errors = 1
>
>
>
> weierophinney wrote:
> >
> > -- asagala <asagala@gmail.com> wrote
> > (on Sunday, 25 October 2009, 04:32 PM -0700):
> >>
> >> When I add these lines
> >>
> >> includePaths.library   = APPLICATION_PATH "/library"
> >> autoloaderNamespaces[] = "Helper_"
> >> resources.frontcontroller.actionhelperpaths.Helper = APPLICATION_PATH
> >> "/library/Helper"
> >>
> >> I get this error
> >> Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception'
> >> with
> >> message 'No default controller directory registered with front
> >> controller'
> >> in C:\Program
> >>
> Files\Zend\ZendServer\share\ZendFramework\library\Zend\Application\Bootstrap\Bootstrap.php
> >
> > You also need the line that defines the controller directory, which is
> > created by default with zf.sh:
> >
> >     resources.frontcontroller.controllerDirectory = APPLICATION_PATH
> > "/controllers"
> >
> >> Also I am using applications and not App. Should of typed the whole
> thing
> >>
> >>
> >>
> >> weierophinney wrote:
> >> >
> >> > -- asagala <asagala@gmail.com> wrote
> >> > (on Sunday, 25 October 2009, 11:33 AM -0700):
> >> >>
> >> >> Got it to work by going through all the loading functions using the
> >> >> debugger.
> >> >> ZF was looking for the file in this directory structure
> >> >>
> >> >> library/
> >> >> --Zend/
> >> >> ----Controller/
> >> >> ------Action/
> >> >> --------Helper/
> >> >> ----------DateTimezone.php
> >> >>
> >> >> Renamed the class to Zend_Controller_Action_Helper_DateTimezone
> >> >>
> >> >> Everything works but still dont understand why I cant get it working
> >> with
> >> >> regular paths.
> >> >
> >> > I've replied to a previous email. You had two issues: the helper was
> >> not
> >> > on the include path, which would not be an issue if you assocated both
> >> a
> >> > path *and* prefix when initializing the helper broker. My other email
> >> > contains the information you need.
> >> >
> >> >
> >> >> asagala wrote:
> >> >> >
> >> >> > Tried that. It doesnt work.
> >> >> >
> >> >> >
> >> >> >
> >> >> > weierophinney wrote:
> >> >> >>
> >> >> >> -- asagala <asagala@gmail.com> wrote
> >> >> >> (on Sunday, 25 October 2009, 09:45 AM -0700):
> >> >> >>>
> >> >> >>> Added autoloaderNamespaces[] = "Helper_" to my application.ini
> >> file
> >> >> but
> >> >> >>> still
> >> >> >>> no success. I still get that the Action Helper is not found
> >> >> >>>
> >> >> >>>
> >> >> >>>
> >> >> >>> weierophinney wrote:
> >> >> >>> >
> >> >> >>> > -- asagala <asagala@gmail.com> wrote
> >> >> >>> > (on Sunday, 25 October 2009, 06:32 AM -0700):
> >> >> >>> > > Cant seem to get my Action Helpers to be discovered by Zend.
> I
> >> >> have
> >> >> >>> read
> >> >> >>> > > a
> >> >> >>> > > couple of articles but still cant seem to get them to work.
> >> >> >>> > >
> >> >> >>> > > i have this line in the Bootstrap.php
> >> >> >>> > >
> >> >> >>> > > Zend_Controller_Action_HelperBroker::addPrefix('Helper');
> >> >> >>> > >
> >> >> >>> > > My file structure is like this
> >> >> >>> > > App\
> >> >> >>> > >  --library\
> >> >> >>> > >  ----Helper\
> >> >> >>> > >    ------Helper_DateTimezone.php
> >> >> >>
> >> >> >> Here's the other problem. Just call the file "DateTimezone.php",
> >> but
> >> >> >> inside it, have it define the class "Helper_DateTimezone".
> >> >> >>
> >> >> >>
> >> >> >>> > > Class definition is like this
> >> >> >>> > > class Helper_DateTimezone extends
> >> >> >>> Zend_Controller_Action_Helper_Abstract
> >> >> >>> > >
> >> >> >>> > > Also checked that the library folder was in my path with this
> >> >> >>> function
> >> >> >>> > > get_include_path();
> >> >> >>> >
> >> >> >>> > You need to inform the autoloader about the "Helper_"
> namespace.
> >> >> Since
> >> >> >>> > you're clearly using Zend_Application, you can do this in your
> >> >> >>> > configuration file. Add the following:
> >> >> >>> >
> >> >> >>> >    autoloaderNamespaces[] = "Helper_"
> >> >> >>> >
> >> >> >>> > or, if using an XML configuration:
> >> >> >>> >
> >> >> >>> >     <autoloaderNamespaces> Helper_</autoloaderNamespaces>
> >> >> >>> >
> >> >> >>> > --
> >> >> >>> > Matthew Weier O'Phinney
> >> >> >>> > Project Lead            | matthew@zend.com
> >> >> >>> > Zend Framework          | http://framework.zend.com/
> >> >> >>> >
> >> >> >>> >
> >> >> >>>
> >> >> >>> --
> >> >> >>> View this message in context:
> >> >> >>>
> >> >>
> >> http://www.nabble.com/Action-Helpers-not-found-tp26047888p26049606.html
> >> >> >>> Sent from the Zend Framework mailing list archive at Nabble.com.
> >> >> >>>
> >> >> >>
> >> >> >> --
> >> >> >> Matthew Weier O'Phinney
> >> >> >> Project Lead            | matthew@zend.com
> >> >> >> Zend Framework          | http://framework.zend.com/
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >> http://www.nabble.com/Action-Helpers-not-found-tp26047888p26050524.html
> >> >> Sent from the Zend Framework mailing list archive at Nabble.com.
> >> >>
> >> >
> >> > --
> >> > Matthew Weier O'Phinney
> >> > Project Lead            | matthew@zend.com
> >> > Zend Framework          | http://framework.zend.com/
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Action-Helpers-not-found-tp26047888p26052995.html
> >> Sent from the Zend Framework mailing list archive at Nabble.com.
> >>
> >
> > --
> > Matthew Weier O'Phinney
> > Project Lead            | matthew@zend.com
> > Zend Framework          | http://framework.zend.com/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Action-Helpers-not-found-tp26047888p26070449.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>
asagala

Re: Action Helpers not found

Reply Threaded More More options
Print post
Permalink
In reply to this post by weierophinney
Can you send me a copy of your bootstrap.php file and application.ini so I see what a working one looks like


weierophinney wrote:
-- asagala <asagala@gmail.com> wrote
(on Sunday, 25 October 2009, 11:02 AM -0700):
>
> Tried that. It doesnt work.

Is App/library on your include_path?

If it is, and things still aren't working, then you need to send me the
exact code to reproduce it. I just tried the following:

    App/
        Bootstrap.php
        library/
            Helper/
                DateTimezone.php
        configs/
            application.ini
        controllers/
            IndexController.php
        views/
            scripts/
                index.phtml
    public/
        .htaccess
        index.php

In index.php, I define APPLICATION_PATH to point to the 'App' directory
(question: why are you using 'App' and not 'application'?). My
App/configs/application.ini file adds these directives:

    includePaths.library   = APPLICATION_PATH "/library"
    autoloaderNamespaces[] = "Helper_"
    resources.frontcontroller.actionhelperpaths.Helper = APPLICATION_PATH "/library/Helper"

In App/library/Helper/DateTimezone.php, I have the following class:

    class Helper_DateTimezone extends Zend_Controller_Action_Helper_Abstract
    {
    }

I can then grab the helper in my controller:

    class IndexController extends Zend_Controller_Action
    {
        public function indexAction()
        {
            $helper = $this->_helper->getHelper('DateTimezone');
        }
    }

Please make sure that you are following the above directions.

> weierophinney wrote:
> >
> > -- asagala <asagala@gmail.com> wrote
> > (on Sunday, 25 October 2009, 09:45 AM -0700):
> >>
> >> Added autoloaderNamespaces[] = "Helper_" to my application.ini file but
> >> still
> >> no success. I still get that the Action Helper is not found
> >>
> >>
> >>
> >> weierophinney wrote:
> >> >
> >> > -- asagala <asagala@gmail.com> wrote
> >> > (on Sunday, 25 October 2009, 06:32 AM -0700):
> >> > > Cant seem to get my Action Helpers to be discovered by Zend. I have
> >> read
> >> > > a
> >> > > couple of articles but still cant seem to get them to work.
> >> > >
> >> > > i have this line in the Bootstrap.php
> >> > >
> >> > > Zend_Controller_Action_HelperBroker::addPrefix('Helper');
> >> > >
> >> > > My file structure is like this
> >> > > App\
> >> > >  --library\
> >> > >  ----Helper\
> >> > >    ------Helper_DateTimezone.php
> >
> > Here's the other problem. Just call the file "DateTimezone.php", but
> > inside it, have it define the class "Helper_DateTimezone".
> >
> >
> >> > > Class definition is like this
> >> > > class Helper_DateTimezone extends
> >> Zend_Controller_Action_Helper_Abstract
> >> > >
> >> > > Also checked that the library folder was in my path with this
> >> function
> >> > > get_include_path();
> >> >
> >> > You need to inform the autoloader about the "Helper_" namespace. Since
> >> > you're clearly using Zend_Application, you can do this in your
> >> > configuration file. Add the following:
> >> >
> >> >    autoloaderNamespaces[] = "Helper_"
> >> >
> >> > or, if using an XML configuration:
> >> >
> >> >     <autoloaderNamespaces> Helper_</autoloaderNamespaces>
> >> >
> >> > --
> >> > Matthew Weier O'Phinney
> >> > Project Lead            | matthew@zend.com
> >> > Zend Framework          | http://framework.zend.com/
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Action-Helpers-not-found-tp26047888p26049606.html
> >> Sent from the Zend Framework mailing list archive at Nabble.com.
> >>
> >
> > --
> > Matthew Weier O'Phinney
> > Project Lead            | matthew@zend.com
> > Zend Framework          | http://framework.zend.com/
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Action-Helpers-not-found-tp26047888p26050238.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>

--
Matthew Weier O'Phinney
Project Lead            | matthew@zend.com
Zend Framework          | http://framework.zend.com/
asagala

Re: Action Helpers not found

Reply Threaded More More options
Print post
Permalink
In reply to this post by asagala
Found the solution. I have this at the start of my boostrap

        $moduleLoader = new Zend_Application_Module_Autoloader(array(
            'namespace' => '',
            'basePath'  => APPLICATION_PATH));
        return $moduleLoader;

the return $moduleLoader basicaly doesnt allow the rest of the boostrap to be executed! Moved the Zend_Controller_Action_HelperBroker::addPrefix('Helper'); in its own init method and everything works!



asagala wrote:
Hi,

Cant seem to get my Action Helpers to be discovered by Zend. I have read a couple of articles but still cant seem to get them to work.

i have this line in the Bootstrap.php

Zend_Controller_Action_HelperBroker::addPrefix('Helper');

My file structure is like this
App\
 --library\
 ----Helper\
   ------Helper_DateTimezone.php

Class definition is like this
class Helper_DateTimezone extends Zend_Controller_Action_Helper_Abstract

Also checked that the library folder was in my path with this function get_include_path();

Anyone have a clue.