Zend FR

Consultez la FAQ sur le ZF avant de poster une question

Vous n'êtes pas identifié.

#1 13-08-2009 09:06:16

martinsupiot
Membre
Lieu: Nantes
Date d'inscription: 20-03-2007
Messages: 52
Site web

[résolu][ZendX_JQuery][1.9] Installation

Bonjour,

J'essaie de mettre en place JQuery que je connais bien sur mon projet Zend Framework qui tourne sans problème.
Les documentations sur l'installation sont peu nombreuses et contradictoires.

J'ai donc besoin de quelques détails. Ou est il plus logique d'installer la librairie ? Au même niveau que la lib zend ou dans un dossier extras/library ?

J'ai testé les deux solutions et j'en arrive toujours au même point à savoir :

Code:

Fatal error: Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name 'Jquery' was not found in the registry; used paths: ZendX_JQuery_View_Helper_: ZendX/JQuery/View/Helper/ Zend_View_Helper_: Zend/View/Helper/' in /var/www/mbg/library/Zend/Loader/PluginLoader.php:401 Stack trace: #0 /var/www/mbg/library/Zend/View/Abstract.php(1118): Zend_Loader_PluginLoader->load('Jquery') #1 /var/www/mbg/library/Zend/View/Abstract.php(569): Zend_View_Abstract->_getPlugin('helper', 'jquery') #2 /var/www/mbg/library/Zend/View/Abstract.php(336): Zend_View_Abstract->getHelper('jquery') #3 [internal function]: Zend_View_Abstract->__call('jquery', Array) #4 /var/www/mbg/application/Bootstrap.php(155): Zend_View->jquery() #5 /var/www/mbg/library/Zend/Application/Bootstrap/BootstrapAbstract.php(660): Bootstrap->_initView() #6 /var/www/mbg/library/Zend/Application/Bootstrap/BootstrapAbstract.php(613): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('view in /var/www/mbg/library/Zend/Loader/PluginLoader.php on line 401

Et ce problème serait lié à un problème d'include_path qui me semble bon. Confirmez vous cette piste ?

Merci !

Dernière modification par martinsupiot (13-08-2009 22:42:03)

Hors ligne

 

#2 13-08-2009 09:17:33

throrin19
Membre
Date d'inscription: 01-03-2009
Messages: 318
Site web

Re: [résolu][ZendX_JQuery][1.9] Installation

la library ZendX tu la place dans le dossier library. Jusque là sa va.
Son chargement automatique est aussi fait directement par Zend car il utilise deux namespaces par défaut: Zend et ZendX.

Par contre dans ton bootstrap tu as juste à rajouter le chemin vers les aides de vue de jquery au niveau _initView()

Si tu veux plus d'infos tu aura un exemple ici http://www.throrinstudio.com/blog/index … article/16

Hors ligne

 

#3 13-08-2009 10:03:10

martinsupiot
Membre
Lieu: Nantes
Date d'inscription: 20-03-2007
Messages: 52
Site web

Re: [résolu][ZendX_JQuery][1.9] Installation

J'ai comparé ton bootstrap au mien et en gros on fait la même chose. Ce qui m'étonne c'est que si je fait un var_dump de $view->jquery() dans le bootstrap j'ai le résultat suivant alors que je n'ai rien dans mon layout !!!

Code:

 object(ZendX_JQuery_View_Helper_JQuery_Container)#46 (15) {
  ["_jqueryLibraryPath:protected"]=>
  NULL
  ["_javascriptSources:protected"]=>
  array(0) {
  }
  ["_enabled:protected"]=>
  bool(false)
  ["_captureLock:protected"]=>
  bool(false)
  ["_javascriptStatements:protected"]=>
  array(0) {
  }
  ["_stylesheets:protected"]=>
  array(0) {
  }
  ["_onLoadActions:protected"]=>
  array(0) {
  }
  ["_isXhtml:protected"]=>
  bool(false)
  ["_version:protected"]=>
  string(5) "1.3.2"
  ["_renderMode:protected"]=>
  int(255)
  ["_uiEnabled:protected"]=>
  bool(false)
  ["_uiPath:protected"]=>
  NULL
  ["_uiVersion:protected"]=>
  string(5) "1.7.1"
  ["_loadSslCdnPath:protected"]=>
  bool(false)
  ["view"]=>
  object(Zend_View)#37 (18) {
    ["_useViewStream:private"]=>
    bool(true)
    ["_useStreamWrapper:private"]=>
    bool(false)
    ["_path:private"]=>
    array(3) {
      ["script"]=>
      array(0) {
      }
      ["helper"]=>
      array(0) {
      }
      ["filter"]=>
      array(0) {
      }
    }
    ["_file:private"]=>
    NULL
    ["_helper:private"]=>
    array(2) {
      ["Doctype"]=>
      object(Zend_View_Helper_Doctype)#49 (4) {
        ["_defaultDoctype:protected"]=>
        string(11) "HTML4_LOOSE"
        ["_registry:protected"]=>
        object(ArrayObject)#47 (2) {
          ["doctypes"]=>
          array(9) {
            ["XHTML11"]=>
            string(97) ""
            ["XHTML1_STRICT"]=>
            string(109) ""
            ["XHTML1_TRANSITIONAL"]=>
            string(121) ""
            ["XHTML1_FRAMESET"]=>
            string(113) ""
            ["XHTML_BASIC1"]=>
            string(109) ""
            ["HTML4_STRICT"]=>
            string(90) ""
            ["HTML4_LOOSE"]=>
            string(102) ""
            ["HTML4_FRAMESET"]=>
            string(101) ""
            ["HTML5"]=>
            string(15) ""
          }
          ["doctype"]=>
          string(13) "XHTML1_STRICT"
        }
        ["_regKey:protected"]=>
        string(24) "Zend_View_Helper_Doctype"
        ["view"]=>
        object(Zend_View)#37 (18) {
          ["_useViewStream:private"]=>
          bool(true)
          ["_useStreamWrapper:private"]=>
          bool(false)
          ["_path:private"]=>
          array(3) {
            ["script"]=>
            array(0) {
            }
            ["helper"]=>
            array(0) {
            }
            ["filter"]=>
            array(0) {
            }
          }
          ["_file:private"]=>
          NULL
          ["_helper:private"]=>
          array(2) {
            ["Doctype"]=>
            object(Zend_View_Helper_Doctype)#49 (4) {
              ["_defaultDoctype:protected"]=>
              string(11) "HTML4_LOOSE"
              ["_registry:protected"]=>
              object(ArrayObject)#47 (2) {
                ["doctypes"]=>
                array(9) {
                  ["XHTML11"]=>
                  string(97) ""
                  ["XHTML1_STRICT"]=>
                  string(109) ""
                  ["XHTML1_TRANSITIONAL"]=>
                  string(121) ""
                  ["XHTML1_FRAMESET"]=>
                  string(113) ""
                  ["XHTML_BASIC1"]=>
                  string(109) ""
                  ["HTML4_STRICT"]=>
                  string(90) ""
                  ["HTML4_LOOSE"]=>
                  string(102) ""
                  ["HTML4_FRAMESET"]=>
                  string(101) ""
                  ["HTML5"]=>
                  string(15) ""
                }
                ["doctype"]=>
                string(13) "XHTML1_STRICT"
              }
              ["_regKey:protected"]=>
              string(24) "Zend_View_Helper_Doctype"
              ["view"]=>
              *RECURSION*
            }
            ["Jquery"]=>
            object(ZendX_JQuery_View_Helper_JQuery)#48 (2) {
              ["view"]=>
              *RECURSION*
              ["_container"]=>
              object(ZendX_JQuery_View_Helper_JQuery_Container)#46 (15) {
                ["_jqueryLibraryPath:protected"]=>
                NULL
                ["_javascriptSources:protected"]=>
                array(0) {
                }
                ["_enabled:protected"]=>
                bool(false)
                ["_captureLock:protected"]=>
                bool(false)
                ["_javascriptStatements:protected"]=>
                array(0) {
                }
                ["_stylesheets:protected"]=>
                array(0) {
                }
                ["_onLoadActions:protected"]=>
                array(0) {
                }
                ["_isXhtml:protected"]=>
                bool(false)
                ["_version:protected"]=>
                string(5) "1.3.2"
                ["_renderMode:protected"]=>
                int(255)
                ["_uiEnabled:protected"]=>
                bool(false)
                ["_uiPath:protected"]=>
                NULL
                ["_uiVersion:protected"]=>
                string(5) "1.7.1"
                ["_loadSslCdnPath:protected"]=>
                bool(false)
                ["view"]=>
                *RECURSION*
              }
            }
          }
          ["_helperLoaded:private"]=>
          array(0) {
          }
          ["_helperLoadedDir:private"]=>
          array(0) {
          }
          ["_filter:private"]=>
          array(0) {
          }
          ["_filterClass:private"]=>
          array(0) {
          }
          ["_filterLoaded:private"]=>
          array(0) {
          }
          ["_filterLoadedDir:private"]=>
          array(0) {
          }
          ["_escape:private"]=>
          string(16) "htmlspecialchars"
          ["_encoding:private"]=>
          string(5) "UTF-8"
          ["_lfiProtectionOn:private"]=>
          bool(true)
          ["_loaders:private"]=>
          array(2) {
            ["filter"]=>
            object(Zend_Loader_PluginLoader)#44 (4) {
              ["_loadedPluginPaths:protected"]=>
              array(0) {
              }
              ["_loadedPlugins:protected"]=>
              array(0) {
              }
              ["_prefixToPaths:protected"]=>
              array(1) {
                ["Zend_View_Filter_"]=>
                array(1) {
                  [0]=>
                  string(17) "Zend/View/Filter/"
                }
              }
              ["_useStaticRegistry:protected"]=>
              NULL
            }
            ["helper"]=>
            object(Zend_Loader_PluginLoader)#50 (4) {
              ["_loadedPluginPaths:protected"]=>
              array(2) {
                ["Doctype"]=>
                string(28) "Zend/View/Helper/Doctype.php"
                ["Jquery"]=>
                string(0) ""
              }
              ["_loadedPlugins:protected"]=>
              array(2) {
                ["Doctype"]=>
                string(24) "Zend_View_Helper_Doctype"
                ["Jquery"]=>
                string(31) "ZendX_JQuery_View_Helper_Jquery"
              }
              ["_prefixToPaths:protected"]=>
              array(2) {
                ["Zend_View_Helper_"]=>
                array(1) {
                  [0]=>
                  string(17) "Zend/View/Helper/"
                }
                ["ZendX_JQuery_View_Helper_"]=>
                array(1) {
                  [0]=>
                  string(25) "ZendX/JQuery/View/Helper/"
                }
              }
              ["_useStaticRegistry:protected"]=>
              NULL
            }
          }
          ["_loaderTypes:private"]=>
          array(2) {
            [0]=>
            string(6) "filter"
            [1]=>
            string(6) "helper"
          }
          ["_strictVars:private"]=>
          bool(false)
          ["_log:private"]=>
          NULL
        }
      }
      ["Jquery"]=>
      object(ZendX_JQuery_View_Helper_JQuery)#48 (2) {
        ["view"]=>
        object(Zend_View)#37 (18) {
          ["_useViewStream:private"]=>
          bool(true)
          ["_useStreamWrapper:private"]=>
          bool(false)
          ["_path:private"]=>
          array(3) {
            ["script"]=>
            array(0) {
            }
            ["helper"]=>
            array(0) {
            }
            ["filter"]=>
            array(0) {
            }
          }
          ["_file:private"]=>
          NULL
          ["_helper:private"]=>
          array(2) {
            ["Doctype"]=>
            object(Zend_View_Helper_Doctype)#49 (4) {
              ["_defaultDoctype:protected"]=>
              string(11) "HTML4_LOOSE"
              ["_registry:protected"]=>
              object(ArrayObject)#47 (2) {
                ["doctypes"]=>
                array(9) {
                  ["XHTML11"]=>
                  string(97) ""
                  ["XHTML1_STRICT"]=>
                  string(109) ""
                  ["XHTML1_TRANSITIONAL"]=>
                  string(121) ""
                  ["XHTML1_FRAMESET"]=>
                  string(113) ""
                  ["XHTML_BASIC1"]=>
                  string(109) ""
                  ["HTML4_STRICT"]=>
                  string(90) ""
                  ["HTML4_LOOSE"]=>
                  string(102) ""
                  ["HTML4_FRAMESET"]=>
                  string(101) ""
                  ["HTML5"]=>
                  string(15) ""
                }
                ["doctype"]=>
                string(13) "XHTML1_STRICT"
              }
              ["_regKey:protected"]=>
              string(24) "Zend_View_Helper_Doctype"
              ["view"]=>
              *RECURSION*
            }
            ["Jquery"]=>
            object(ZendX_JQuery_View_Helper_JQuery)#48 (2) {
              ["view"]=>
              *RECURSION*
              ["_container"]=>
              object(ZendX_JQuery_View_Helper_JQuery_Container)#46 (15) {
                ["_jqueryLibraryPath:protected"]=>
                NULL
                ["_javascriptSources:protected"]=>
                array(0) {
                }
                ["_enabled:protected"]=>
                bool(false)
                ["_captureLock:protected"]=>
                bool(false)
                ["_javascriptStatements:protected"]=>
                array(0) {
                }
                ["_stylesheets:protected"]=>
                array(0) {
                }
                ["_onLoadActions:protected"]=>
                array(0) {
                }
                ["_isXhtml:protected"]=>
                bool(false)
                ["_version:protected"]=>
                string(5) "1.3.2"
                ["_renderMode:protected"]=>
                int(255)
                ["_uiEnabled:protected"]=>
                bool(false)
                ["_uiPath:protected"]=>
                NULL
                ["_uiVersion:protected"]=>
                string(5) "1.7.1"
                ["_loadSslCdnPath:protected"]=>
                bool(false)
                ["view"]=>
                *RECURSION*
              }
            }
          }
          ["_helperLoaded:private"]=>
          array(0) {
          }
          ["_helperLoadedDir:private"]=>
          array(0) {
          }
          ["_filter:private"]=>
          array(0) {
          }
          ["_filterClass:private"]=>
          array(0) {
          }
          ["_filterLoaded:private"]=>
          array(0) {
          }
          ["_filterLoadedDir:private"]=>
          array(0) {
          }
          ["_escape:private"]=>
          string(16) "htmlspecialchars"
          ["_encoding:private"]=>
          string(5) "UTF-8"
          ["_lfiProtectionOn:private"]=>
          bool(true)
          ["_loaders:private"]=>
          array(2) {
            ["filter"]=>
            object(Zend_Loader_PluginLoader)#44 (4) {
              ["_loadedPluginPaths:protected"]=>
              array(0) {
              }
              ["_loadedPlugins:protected"]=>
              array(0) {
              }
              ["_prefixToPaths:protected"]=>
              array(1) {
                ["Zend_View_Filter_"]=>
                array(1) {
                  [0]=>
                  string(17) "Zend/View/Filter/"
                }
              }
              ["_useStaticRegistry:protected"]=>
              NULL
            }
            ["helper"]=>
            object(Zend_Loader_PluginLoader)#50 (4) {
              ["_loadedPluginPaths:protected"]=>
              array(2) {
                ["Doctype"]=>
                string(28) "Zend/View/Helper/Doctype.php"
                ["Jquery"]=>
                string(0) ""
              }
              ["_loadedPlugins:protected"]=>
              array(2) {
                ["Doctype"]=>
                string(24) "Zend_View_Helper_Doctype"
                ["Jquery"]=>
                string(31) "ZendX_JQuery_View_Helper_Jquery"
              }
              ["_prefixToPaths:protected"]=>
              array(2) {
                ["Zend_View_Helper_"]=>
                array(1) {
                  [0]=>
                  string(17) "Zend/View/Helper/"
                }
                ["ZendX_JQuery_View_Helper_"]=>
                array(1) {
                  [0]=>
                  string(25) "ZendX/JQuery/View/Helper/"
                }
              }
              ["_useStaticRegistry:protected"]=>
              NULL
            }
          }
          ["_loaderTypes:private"]=>
          array(2) {
            [0]=>
            string(6) "filter"
            [1]=>
            string(6) "helper"
          }
          ["_strictVars:private"]=>
          bool(false)
          ["_log:private"]=>
          NULL
        }
        ["_container"]=>
        object(ZendX_JQuery_View_Helper_JQuery_Container)#46 (15) {
          ["_jqueryLibraryPath:protected"]=>
          NULL
          ["_javascriptSources:protected"]=>
          array(0) {
          }
          ["_enabled:protected"]=>
          bool(false)
          ["_captureLock:protected"]=>
          bool(false)
          ["_javascriptStatements:protected"]=>
          array(0) {
          }
          ["_stylesheets:protected"]=>
          array(0) {
          }
          ["_onLoadActions:protected"]=>
          array(0) {
          }
          ["_isXhtml:protected"]=>
          bool(false)
          ["_version:protected"]=>
          string(5) "1.3.2"
          ["_renderMode:protected"]=>
          int(255)
          ["_uiEnabled:protected"]=>
          bool(false)
          ["_uiPath:protected"]=>
          NULL
          ["_uiVersion:protected"]=>
          string(5) "1.7.1"
          ["_loadSslCdnPath:protected"]=>
          bool(false)
          ["view"]=>
          object(Zend_View)#37 (18) {
            ["_useViewStream:private"]=>
            bool(true)
            ["_useStreamWrapper:private"]=>
            bool(false)
            ["_path:private"]=>
            array(3) {
              ["script"]=>
              array(0) {
              }
              ["helper"]=>
              array(0) {
              }
              ["filter"]=>
              array(0) {
              }
            }
            ["_file:private"]=>
            NULL
            ["_helper:private"]=>
            array(2) {
              ["Doctype"]=>
              object(Zend_View_Helper_Doctype)#49 (4) {
                ["_defaultDoctype:protected"]=>
                string(11) "HTML4_LOOSE"
                ["_registry:protected"]=>
                object(ArrayObject)#47 (2) {
                  ["doctypes"]=>
                  array(9) {
                    ["XHTML11"]=>
                    string(97) ""
                    ["XHTML1_STRICT"]=>
                    string(109) ""
                    ["XHTML1_TRANSITIONAL"]=>
                    string(121) ""
                    ["XHTML1_FRAMESET"]=>
                    string(113) ""
                    ["XHTML_BASIC1"]=>
                    string(109) ""
                    ["HTML4_STRICT"]=>
                    string(90) ""
                    ["HTML4_LOOSE"]=>
                    string(102) ""
                    ["HTML4_FRAMESET"]=>
                    string(101) ""
                    ["HTML5"]=>
                    string(15) ""
                  }
                  ["doctype"]=>
                  string(13) "XHTML1_STRICT"
                }
                ["_regKey:protected"]=>
                string(24) "Zend_View_Helper_Doctype"
                ["view"]=>
                *RECURSION*
              }
              ["Jquery"]=>
              object(ZendX_JQuery_View_Helper_JQuery)#48 (2) {
                ["view"]=>
                *RECURSION*
                ["_container"]=>
                *RECURSION*
              }
            }
            ["_helperLoaded:private"]=>
            array(0) {
            }
            ["_helperLoadedDir:private"]=>
            array(0) {
            }
            ["_filter:private"]=>
            array(0) {
            }
            ["_filterClass:private"]=>
            array(0) {
            }
            ["_filterLoaded:private"]=>
            array(0) {
            }
            ["_filterLoadedDir:private"]=>
            array(0) {
            }
            ["_escape:private"]=>
            string(16) "htmlspecialchars"
            ["_encoding:private"]=>
            string(5) "UTF-8"
            ["_lfiProtectionOn:private"]=>
            bool(true)
            ["_loaders:private"]=>
            array(2) {
              ["filter"]=>
              object(Zend_Loader_PluginLoader)#44 (4) {
                ["_loadedPluginPaths:protected"]=>
                array(0) {
                }
                ["_loadedPlugins:protected"]=>
                array(0) {
                }
                ["_prefixToPaths:protected"]=>
                array(1) {
                  ["Zend_View_Filter_"]=>
                  array(1) {
                    [0]=>
                    string(17) "Zend/View/Filter/"
                  }
                }
                ["_useStaticRegistry:protected"]=>
                NULL
              }
              ["helper"]=>
              object(Zend_Loader_PluginLoader)#50 (4) {
                ["_loadedPluginPaths:protected"]=>
                array(2) {
                  ["Doctype"]=>
                  string(28) "Zend/View/Helper/Doctype.php"
                  ["Jquery"]=>
                  string(0) ""
                }
                ["_loadedPlugins:protected"]=>
                array(2) {
                  ["Doctype"]=>
                  string(24) "Zend_View_Helper_Doctype"
                  ["Jquery"]=>
                  string(31) "ZendX_JQuery_View_Helper_Jquery"
                }
                ["_prefixToPaths:protected"]=>
                array(2) {
                  ["Zend_View_Helper_"]=>
                  array(1) {
                    [0]=>
                    string(17) "Zend/View/Helper/"
                  }
                  ["ZendX_JQuery_View_Helper_"]=>
                  array(1) {
                    [0]=>
                    string(25) "ZendX/JQuery/View/Helper/"
                  }
                }
                ["_useStaticRegistry:protected"]=>
                NULL
              }
            }
            ["_loaderTypes:private"]=>
            array(2) {
              [0]=>
              string(6) "filter"
              [1]=>
              string(6) "helper"
            }
            ["_strictVars:private"]=>
            bool(false)
            ["_log:private"]=>
            NULL
          }
        }
      }
    }
    ["_helperLoaded:private"]=>
    array(0) {
    }
    ["_helperLoadedDir:private"]=>
    array(0) {
    }
    ["_filter:private"]=>
    array(0) {
    }
    ["_filterClass:private"]=>
    array(0) {
    }
    ["_filterLoaded:private"]=>
    array(0) {
    }
    ["_filterLoadedDir:private"]=>
    array(0) {
    }
    ["_escape:private"]=>
    string(16) "htmlspecialchars"
    ["_encoding:private"]=>
    string(5) "UTF-8"
    ["_lfiProtectionOn:private"]=>
    bool(true)
    ["_loaders:private"]=>
    array(2) {
      ["filter"]=>
      object(Zend_Loader_PluginLoader)#44 (4) {
        ["_loadedPluginPaths:protected"]=>
        array(0) {
        }
        ["_loadedPlugins:protected"]=>
        array(0) {
        }
        ["_prefixToPaths:protected"]=>
        array(1) {
          ["Zend_View_Filter_"]=>
          array(1) {
            [0]=>
            string(17) "Zend/View/Filter/"
          }
        }
        ["_useStaticRegistry:protected"]=>
        NULL
      }
      ["helper"]=>
      object(Zend_Loader_PluginLoader)#50 (4) {
        ["_loadedPluginPaths:protected"]=>
        array(2) {
          ["Doctype"]=>
          string(28) "Zend/View/Helper/Doctype.php"
          ["Jquery"]=>
          string(0) ""
        }
        ["_loadedPlugins:protected"]=>
        array(2) {
          ["Doctype"]=>
          string(24) "Zend_View_Helper_Doctype"
          ["Jquery"]=>
          string(31) "ZendX_JQuery_View_Helper_Jquery"
        }
        ["_prefixToPaths:protected"]=>
        array(2) {
          ["Zend_View_Helper_"]=>
          array(1) {
            [0]=>
            string(17) "Zend/View/Helper/"
          }
          ["ZendX_JQuery_View_Helper_"]=>
          array(1) {
            [0]=>
            string(25) "ZendX/JQuery/View/Helper/"
          }
        }
        ["_useStaticRegistry:protected"]=>
        NULL
      }
    }
    ["_loaderTypes:private"]=>
    array(2) {
      [0]=>
      string(6) "filter"
      [1]=>
      string(6) "helper"
    }
    ["_strictVars:private"]=>
    bool(false)
    ["_log:private"]=>
    NULL
  }
}

Je penche donc pour un problème de chargement des plugins, un var_dump de $autoloader->getRegisteredNamespaces() dans le bootstrap donne :

Code:

array(3) { [0]=>  string(5) "Zend_" [1]=>  string(6) "ZendX_" [2]=>  string(7) "MBGLib_" }

un var_dump de $view->getHelperPaths() donne :

Code:

array(2) { 
            ["Zend_View_Helper_"]=>  array(1) { [0]=>  string(17) "Zend/View/Helper/" } 
            ["ZendX_JQuery_View_Helper_"]=>  array(1) { [0]=>  string(25) "ZendX/JQuery/View/Helper/" } }

Dernière modification par martinsupiot (13-08-2009 11:15:42)

Hors ligne

 

#4 13-08-2009 13:34:21

throrin19
Membre
Date d'inscription: 01-03-2009
Messages: 318
Site web

Re: [résolu][ZendX_JQuery][1.9] Installation

effectivement c'est bizarre, il devrai pourtant trouver la fonction jquery() qand dans la vue tu fais $this->jQuery()

Verifie que tu fais bien jQuery et non jquery

Hors ligne

 

#5 13-08-2009 14:22:40

martinsupiot
Membre
Lieu: Nantes
Date d'inscription: 20-03-2007
Messages: 52
Site web

Re: [résolu][ZendX_JQuery][1.9] Installation

Dans mon layout j'ai juste :

Code:

if($this->jQuery()->isEnabled()) {
    echo $this->jQuery();
}

Pour afficher le code code dans le header...


Visiblement il cherche à charger la classe : Zend_View_Helper_JQuery qui n'existe pas. Pouvez vous me confirmer qu'elle n'existe pas ? Elle pourrait aussi être manquante dans ma distribution....

Mais ZendX_View_Helper_JQuery existe, alors je pense plutôt que le framework la cherche dans Zend au lieu de ZendX, ce qui est normal vu le préfixe.

J'ai fait un var_dump du registre qui stocke les préfixes :

Code:

         array(3) { 
        ["Zend_View_Helper_Navigation_"]=>  array(1) {
            [0]=>  string(28) "Zend/View/Helper/Navigation/"
        }
        ["ZendX_JQuery_View_Helper_"]=>  array(1) {
            [0]=>  string(25) "ZendX/JQuery/View/Helper/"
        }
        ["Zend_View_Helper_"]=>  array(2) {
            [0]=>  string(17) "Zend/View/Helper/"
            [1]=>  string(46) "/var/www/mbg/application/views/helpers/"
        }

Alors pourquoi ???

A tout hasard je met mon bootstrap complet, peut être y'a t'il une incohérence dedans !

Code:

<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    /** Contrôleur frontal */
    private $front   = null;
    /** Routeur */
    private $router  = null;
    /** Base de données */
    private $db      = null;
    
    
    /**
     * Constructeur de la classe
     */
    public function __construct($application)
    {
        parent::__construct($application);
        
        // Récupération du contrôleur frontal
        $this->front = Zend_Controller_Front::getInstance();   
    }

    /**
     * Charge la configuration
     */
    public function run()
    {
        // Cela permet d'avoir la configuration disponible de partout dans notre application
        Zend_Registry::set('config', new Zend_Config($this->getOptions()));
        parent::run();
    }

    /**
     * Paramètre la base de données
     */
    protected function _initDb()
    {
        $config = new Zend_Config_Ini('configs/database.ini', 'development');
        $this->db = Zend_Db::factory($config->resources->db);
        Zend_Db_Table::setDefaultAdapter($this->db);
    }
    
    /**
     * Initialise l'autoload des classes
     */
    protected function _initAutoload()
    {
        // On enregistre les modules (Backend et Frontend)
        $loader = new Zend_Application_Module_Autoloader(array(
            'namespace' => '', 'basePath' => APPLICATION_PATH));
        $loader->addResourceType('Models', 'models/', 'Models');
        $loader->addResourceType('Forms', 'forms/', 'Forms');
        
        $autoloader = Zend_Loader_Autoloader::getInstance();
        $autoloader->registerNamespace('MBGLib_');

        return $loader;
    }
    
    /**
     * Initialise les helpers
     */
    protected function _initHelpers()
    {
        Zend_Controller_Action_HelperBroker::addPrefix('MBGLib_Controller_Action_Helper');
        Zend_Controller_Action_HelperBroker::addPrefix('ZendX_JQuery_Controller_Action_Helper');
    }
    /**
     * Initialise la session
     */
    protected function _initSession()
    {
        // Chargement du gestionnaire de session en base de données
        //Zend_Session::setSaveHandler(new MBGLib_Session_Dbhandler(Zend_Db_Table_Abstract::getDefaultAdapter()));
        
        // Récupération du paramètrage de la session
        $config = new Zend_Config_Ini('configs/session.ini', 'development');
        Zend_Session::setOptions($config->toArray());
        
        // On initialise la session de base
        $session = new Zend_Session_Namespace('MBG', true);
        
        // Stockage de la session dans un registre
        Zend_Registry::set('session', $session);
        
        // Chargement du plugin de gestion de session
        $this->front->registerPlugin(new MBGLib_Controller_Plugin_Session());
        
        return $session;
    }
    
    /**
     * Paramètres i18n
     */
    protected function _initI18n()
    {
        // Chargement du plugin de gestion des langues
        $this->front->registerPlugin(new MBGLib_Controller_Plugin_Language());
    }
    
    /**
     * Routes
     */
    protected function _initRoutes()
    {
        // Récupération du router
        $this->router = $this->front->getRouter();
        
        // Paramétrage de la route
        $route = new Zend_Controller_Router_Route(
            ':language/:controller/:action/*',
            array(
                'controller' => 'index',
                'action'     => 'index'
            ),
            array('language' => '^(fr|en)$')
        );
        
        // Passage de la route au router
        $this->router->addRoute('default', $route);
    }
    
    /**
     * Navigation
     */
    protected function _initNavigation()
    {
        $this->bootstrap('layout');
        $layout = $this->getResource('layout');
        $view = $layout->getView();     
        $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml', 'nav');

        $navigation = new Zend_Navigation($config);
        
        $view->navigation($navigation);
    }
    
    /**
     * Initialise l'envoi des mails
     */
    protected function _initMail()
    {
        $config = new Zend_Config_Ini('configs/mail.ini', 'development');
        $transport = new Zend_Mail_Transport_Smtp($config->mail->smtp);
        Zend_Mail::setDefaultTransport($transport);
    }
    
    /**
     * Initialise la vue
     * et force le doctype en XHTML
     */
    protected function _initView()
    {
        // Initialisation de la vue et des helpers de vue
        $view = new Zend_View();
        $view->setEncoding('UTF-8');
        $view->doctype('XHTML1_STRICT');
        
        $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
        $view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper_');
        
        $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
        $viewRenderer->setView($view);
        
        $view->jQuery()->setCdnVersion('1.3.2');
        $view->jQuery()->enable();
        
        return $view;
    }
    
    /**
     * Initialise les droits et stockage en session
     */
    protected function _initAcl()
    {
        // On initialise la session acl
        $session = Zend_Registry::get('session');
        
        // Définition des droits si besoin
        if(!isset($session->acl)) {
     
            // Initialisation des rôles       
            $acl = new Zend_Acl();
            $acl->addRole(new Zend_Acl_Role('user'));

            // Initialisation des droits
            $acl->add(new Zend_Acl_Resource('change-pass'));
            $acl->add(new Zend_Acl_Resource('log-out'));
            $acl->add(new Zend_Acl_Resource('sign-out'));
            
            // Stockage en session
            $session->acl = $acl;
        }
        
        // Stockage de la session dans un registre
        Zend_Registry::set('session', $session);
        
        // Gestion des acl dans la navigation
        Zend_View_Helper_Navigation_HelperAbstract::setDefaultAcl($session->acl);
        Zend_View_Helper_Navigation_HelperAbstract::setDefaultRole('user');
    }
}

Dernière modification par martinsupiot (13-08-2009 16:01:59)

Hors ligne

 

#6 13-08-2009 19:34:48

throrin19
Membre
Date d'inscription: 01-03-2009
Messages: 318
Site web

Re: [résolu][ZendX_JQuery][1.9] Installation

je vois vraiment pas pourquoi, j'ai à peu près la même configuration que toi et si Zend trouve pas ton helper dans Zend_ il regarde dans ZendX_ puis dans les autres namespaces jusqu'à ce qu'il y arrive.

Hors ligne

 

#7 13-08-2009 20:58:49

martinsupiot
Membre
Lieu: Nantes
Date d'inscription: 20-03-2007
Messages: 52
Site web

Re: [résolu][ZendX_JQuery][1.9] Installation

J'ai créé un projet secondaire avec le strict minimum et ca fonctionne, reste à ré-assembler le puzzle !

Hors ligne

 

#8 13-08-2009 22:41:33

martinsupiot
Membre
Lieu: Nantes
Date d'inscription: 20-03-2007
Messages: 52
Site web

Re: [résolu][ZendX_JQuery][1.9] Installation

Bon, c'est corrigé...

J'ai inversé les méthodes _initView et _initNavigation, j'utilisais deux objets vue différents en fait...

Hors ligne

 

Pied de page des forums

Propulsé par PunBB
© Copyright 2002–2005 Rickard Andersson
Traduction par punbb.fr

Graphisme réalisé par l'agence Rodolphe Eveilleau
Développement par Kitpages