Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [ZendFramework] plugin, Nie znajduje custom pluginu
JakubBab
post
Post #1





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

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


Niby prosty plugin do css ale z jakiegos powodu zend nie chce mi go znalesc. Siedze juz ktoras godzine i nie moge sie dopatrzec. Moze ktos ma lepsze oczeta

**blad**
Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'Unable to resolve plugin "page"; no corresponding plugin with that name' in ..
**
sciezka

Library/My/Application

  1.  
  2.  
  3. class My_Application_Resource_Page extends Zend_Application_Resource_ResourceAbstract {
  4. protected $_page;
  5. public function getPage()
  6. {
  7. if(null===$this->_page)
  8. {
  9. $this->_page = New My_Page($this->getOptions());
  10. }
  11. return $this->_page;
  12. }
  13.  
  14. public function init()
  15. {
  16. $page = $this->getPage();
  17.  
  18.  
  19. $bootstrap = $this->getBoootstrap();
  20. $bootstrap -> bootstrap(array('layout','view','frontController'));
  21.  
  22. $front = $bootstrap->getResource('frontController');
  23.  
  24.  
  25. $request = new Zend_Controller_Request_Http();
  26. $front->setRequest($request);
  27. $baseUrl = $request->getBaseUrl();
  28.  
  29. foreach($page->getCss()as $css){
  30. if(isset($css['media'])){
  31. $view->headLink()->appendStylesheet($baseUrl,$css['href'],$css['media']);
  32. }else{
  33. $view->headLink()->appendStylesheet($baseUrl,$css['href']);
  34. }
  35. }
  36. return $page;
  37. }
  38.  
  39. }


co do my_page to plik z Library/My
  1. class My_Page{
  2.  
  3. protected $_options;
  4.  
  5.  
  6.  
  7. public function __construct(array $options = null)
  8. {
  9. if($options === null)
  10. {
  11. $this->_options = array();
  12. }else
  13. {
  14. $this->_options =$options;
  15. }
  16. if(isset($this->_options['css']))
  17. {
  18. $this->_options['css']=[];
  19. }
  20.  
  21.  
  22. [php]

[/php]
No i .ini

autoloaderNamespace[] = "My"
pluginPath.My = APPLICATION_PATH "/../library/My/Resource"
resources.page.css = "/css/style.css"

Rozwiazalem (IMG:style_emoticons/default/graduated.gif)

A wiec : Plik z library My/application/resources/page.php nie czyta pliku z /library/My

Chyba powinien skoro jest autloader .. nie configurowalem go wiec powinien czytac wszystkie pliki.



Nastepnie trzeba bylo dodac $op ->getOptions(), zbindowac $view= new Zend_View($op),

Zmienic petle na
  1. foreach ($this->_options['css'] as $css){
  2.  
  3. $view->headLink()->appendStylesheet($baseUrl.$css['href'])
  4. }


I dziala

Ten post edytował JakubBab 29.02.2016, 16:17:22
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 25.12.2025 - 13:35