Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [ZendFramework] View Helper, View helper dziala w widoku a w layout nie
JakubBab
post
Post #1





Grupa: Zarejestrowani
Postów: 96
Pomógł: 2
Dołączył: 13.07.2015

Ostrzeżenie: (0%)
-----


Czesc,

Napisalem view helpera co by nie zasmiecac layoutu. Jak wkladam go do layout to dotaje blad (ponizej), natomiast w view dziala bez problemu. Ktos cos?

  1. Fatal error: Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name 'ActionName' was not found in the registry; used paths: Zend_View_Helper_Navigation_: Zend/View/Helper/Navigation/ Zend_View_Helper_: Zend/View/Helper/;./views\helpers/' in C:\xampp\htdocs\shop\vendor\Zend\Loader\PluginLoader.php:424 Stack trace: #0 C:\xampp\htdocs\shop\vendor\Zend\View\Abstract.php(1182): Zend_Loader_PluginLoader->load('ActionName')




Plugin
  1.  
  2. <?php
  3.  
  4. class Zend_View_Helper_HeadHelp extends Zend_View_Helper_Abstract {
  5.  
  6. public $markUp;
  7.  
  8. public function HeadHelp($layout=null) {
  9.  
  10. $this->markUp.= ' <body>';
  11. $this->markUp .= '<div class ="maincontainer">';
  12. $this->markUp .= ' <div class="topblog">';
  13. $this->markUp .= ' <div id="logo">';
  14. $this->markUp .= ' <img src="images/logo.png" alt="Smiley face">';
  15. $this->markUp .= ' </div>';
  16.  
  17. $this->markUp .= ' <div id="searchme">';
  18.  
  19. $this->markUp .= $layout;
  20.  
  21. $this->markUp .= ' </div>';
  22.  
  23. $this->markUp .= ' <div id="tel">';
  24. $this->markUp .= ' <img src="images/phoneContact.png" alt="Smiley face"> 0880000541 321';
  25.  
  26. $this->markUp .= '</div>';
  27. $this->markUp .= '<div id="shop">';
  28. $this->markUp .= '<img src="images/shopCardHover.png" alt="Smiley face"> Koszyk';
  29.  
  30. $this->markUp .= '</div>';
  31.  
  32.  
  33. $this->markUp .= '</div>';
  34.  
  35. return $this->markUp;
  36. }
  37. }
  38.  



Manual prawde Ci powie... po tylu godzinach znalazlem:

To use a helper in your view script, call it using$this->helperName(). Behind the scenes,Zend_View will load theZend_View_Helper_HelperName class, create an object instance of it, and call its helperName()method. The object instance is persistent within the Zend_View instance, and is reused for all future calls to $this->helperName().

Pozdr.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.08.2025 - 08:45