I've spend all day an I cannot get it working.
I have this custom view helper class:
class ShowPopupMessages extends Zend_View_Helper_Abstract {
public function showPopupMessages()
{
$flashMessenger = Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger');
if($flashMessenger->hasMessages()) {
$msg =$flashMessenger->getMessages()[0];
return "ShowToastMessage('$msg','success')";
}
}
}
I attach the image of file structure of my project
I'm trying to register this class in my Bootstrap.php:
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
protected function _initPlaceholders()
{
$this->bootstrap('view');
$view = $this->getResource('view');
$view->doctype('XHTML1_STRICT');
$view->addHelperPath(
APPLICATION_PATH.'/views/helpers/', 'ShowPopupMessages'
);
$helper = new ShowPopupMessages();
$view->registerHelper($helper, 'showPopupMessages');
}
This is my application.ini:
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.view.doctype = "XHTML1_STRICT"
resources.view.helperPath = APPLICATION_PATH "/views/helpers"
but I keep getting:
Fatal error: Class 'ShowPopupMessages' not found in C:\xampp\htdocs\Platforma\application\Bootstrap.php on line 19
Is the class name wrong? Placement in the tree? Can I make it autoload somehow (writing so much code to register each helper is a madness!)? If so, where to put it in the project tree?
Sorry but Zend docs are so proorly written, I just can't learn from them.
Thanks and regards!
Tom