Hi All,
I'm looking for a couple of pointers to get me started with ZF1.8
bootstrapping as I appear to be making mistakes. I'm just starting with ZF
and there seems to be a change in 1.8 so I'm starting with a fresh project
using the zf cli tool. I used Rob Allen's (akrabat.com) getting latest
started document and the code works fine, it's just when I start to build my
own helpers that my server can't seem to resolve them.
I have created a basic extension to Zend_Controller_Action_Helper_Abstract
and placed it in the following directory:
MYWEBROOT/library/Andy/Controller/Action/Helper/ActHelp.php
I copied the structure that I found for another action helper that I saw in
the "Zend Framework in Action" book. I'm expecting to be able to invoke my
helper from the init() function of a controller as follows:
$acthelp = new Andy_Controller_Action_Helper_ActHelp();
Zend_Controller_Action_HelperBroker::addHelper($acthelp);
But I get the message:
Fatal error: Class 'Andy_Controller_Action_Helper_ActHelp' not found
Ok so what is the correct way of informing the auto loader to pick this up?
I thought something like...
//inside bootstrap.php as generated by zf cli...
protected function _initAutoload()
{
require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance();
$loader->registerNamespace('Andy_');
$moduleLoader = new Zend_Application_Module_Autoloader(array(
'namespace' => '',
'basePath' => APPLICATION_PATH));
return $moduleLoader;
}
But to be honest it's a bit of a stab in the dark and it doesn't work. I'm
not sure about the Zend_Application_Module_Autoloader object here, whether I
should modify that?
Here's my complete php include path:
C:\htdocs\zf3\application/../library;
C:/php/PEAR;
C:/php/includes;
C:/htdocs/API/zend/library
The htdocs/zf3 folder is just the root of my virtual host "http://zf3.local"
and API/zend/library is a the full framework in a single folder that is
shared between virtual hosts.
Thanks,
Andy
--
View this message in context:
http://www.nabble.com/Bootstrap-custom-action-helper-in-1.8-tp23443779p23443779.html
Sent from the Zend Framework mailing list archive at Nabble.com.