Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I use the following implementation of modules in Zend. It allows you to use "module-specific" configuration.</p> <pre><code>application/config/config.ini ----------------------------- [production] resources.modules[] = </code></pre> <p>By doing this, you're telling Zend_Application that you want to use the Modules Bootstrap Resource plugin. The Modules plugin will load a separate bootsrap class for each of your modules, excluding the default module. Therefore, you need to create a new bootstrap class for your second module.</p> <pre><code>application/modules/news/Bootstrap.php ----------------------------- class News_Bootstrap extends Zend_Application_Module_Bootstrap { //--------------------------------------- // Automatically load our resources // // NOTE: You don't have to add this, its // just and example to show that you // can customize the bootstrap // process just for this module. public function _initModuleResourceAutoloader(){ $this-&gt;getResourceLoader()-&gt;addResourceTypes(array( 'modelResource' =&gt; array( 'path' =&gt; 'models/resources', 'namespace' =&gt; 'Resource' ) )); } } </code></pre> <p>This "News_Bootstrap" class will now be loaded and executed during the bootstrap process.</p> <p>The naming convention for this file is important as the Modules Resource plugin needs to be able to find the class. Note that you <strong>must</strong> name the file Bootstrap.php. </p> <p>Finally, you'll notice that you're subclassing the Zend_Application_Module_Bootstrap rather than Zend_Application_Bootstrap_Bootstrap like you do in the main bootstrap.</p> <p>Now, your module-specific configuration should work:</p> <pre><code>[production] news.resources.db.adapter = "pdo_mysql" news.resources.db.params.host = "localhost" news.resources.db.params.username = "webuser" news.resources.db.params.password = "XXXXXXX" news.resources.db.params.dbname = "news" </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload