Consultez la FAQ sur le ZF avant de poster une question
Vous n'êtes pas identifié.
Bonjour, je suis le tuto pour utiliser un helper mais je n'y arrive pas, voici les script
le fichier helper Notice.php
libray/App/View/Helper/Notice.php
<?php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { protected function _initLayout() { $view = Zend_Layout::getMvcInstance()->getView(); $view->doctype('XHTML1_STRICT'); $view->addHelperPath('App/View/Helper', 'App_View_Helper'); } }
mon index.html
<h2>HTMLtest des helpers</h2> <?php echo $this->notice();?>
mon controller est vide
<?php class IndexController extends Zend_Controller_Action { public function init() { /* Initialize action controller here */ } public function indexAction() { } }
l'index.html
<h2>test helper</h2> <?php echo $this->notice();?>
ca ne fonctionne pas
Fatal error: Call to a member function getView() on a non-object in /var/www/helper/application/Bootstrap.php on line 6
la ligne 6 c'est
$view = Zend_Layout::getMvcInstance()->getView();
Pourquoi le boostrap ne veut pas charger le helper ?
je vous remercie d'avance de la réponse
Dernière modification par keokaz (12-09-2011 13:54:02)
Hors ligne
j'ai trouver mon erreur, j'ai modifier mon boostrap
public function _initLayout() { Zend_Layout::startMvc(APPLICATION_PATH.'/layouts/scripts'); $view = Zend_Layout::getMvcInstance()->getView(); $view->addHelperPath('App/View/Helper','App_View_Helper'); }
Hors ligne