Bonjour,
J'utilise pour mon app plusieurs helper que j'utilise dans plusieurs "views".
Je les ais placé dans un folder "library" tel que décrit ci dessous.
root
> application
> public
> library
>> zend // contient le code du framework
>> aidefrancais
>>> view
>>>> helper
Le dossier helper contient les fichiers dont, pour donner un exemple, "staticUrl.php" qui contient le code suivant:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| <?php
class aidefrancais_view_helper_staticUrl {
public $view;
public function setView(Zend_View_Interface $view) {
$this->view = $view;
}
public function staticUrl($url) {
$config = Zend_Registry::get('config');
return $config->site->staticUrl.$this->view->escape($url);
}
} |
Dans lans l'action _initViewHelpers du fichier bootstrap.php, j'ai ajouté la ligne suivante:
$view->addHelperPath('aidefrancais/view/helper/', 'aidefrancais_View_Helper');
et dans aplication.ini:
includePaths.library = APPLICATION_PATH "/../library"
Cela fonctionne très bien en local (j'utilise MAMP) mais pas en production (je suis en mutualisé sur OVH) ou j'obtiens l'erreur suivante:
Fatal error: Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name 'StaticUrl' was not found in the registry; used paths: aidefrancais_View_Helper_: aidefrancais/view/helper/ Zend_View_Helper_: Zend/View/Helper/:/homez.62/collabor/www/aidefrancais2/application/modules/default/views/helpers/' in /homez.62/collabor/www/aidefrancais2/library/Zend/Loader/PluginLoader.php:412 Stack trace: #0 /homez.62/collabor/www/aidefrancais2/library/Zend/View/Abstract.php(1174): Zend_Loader_PluginLoader->load('StaticUrl') #1 /homez.62/collabor/www/aidefrancais2/library/Zend/View/Abstract.php(610): Zend_View_Abstract->_getPlugin('helper', 'staticUrl') #2 /homez.62/collabor/www/aidefrancais2/library/Zend/View/Abstract.php(336): Zend_View_Abstract->getHelper('staticUrl') #3 /homez.62/collabor/www/aidefrancais2/application/layouts/scripts/layout.phtml(8): Zend_View_Abstract->__call('staticUrl', Array) #4 /homez.62/collabor/www/aidefrancais2/application/layouts/scripts/layout.phtml(8): Zend_View->staticUrl('/css/ma in /homez.62/collabor/www/aidefrancais2/library/Zend/Loader/PluginLoader.php on line 412
Je tourne en rond sur ce bug depuis 1 jour. C'est la première fois que je déploie seul une application zend en ligne. Si vous avez une piste, je la suivrais 
Merci beaucoup !
Partager