zend framework modules

訾旭
2023-12-01

1. update  $APP_DIR/application/configs/application.ini

resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"

resources.modules = ""

2. Creating the Default Module
The first step is to create the $APP_DIR/application/modules/ directory, and then create a set of
subdirectories within that for the default module and its controllers and views. The zf commandline
tool does not create these directories, and so it is necessary to perform this task manually.
shell> cd /usr/local/apache/htdocs/square/application
shell> mkdir modules
shell> mkdir modules/default
Next, move the existing models, controllers, and views from $APP_DIR/application/* to
$APP_DIR/application/modules/default/*:
shell> mv controllers modules/default/
shell> mv views modules/default/
shell> mv models modules/default/


补充一下,可以通过

resources.frontController.defaultModule= "default"

来修改默认modules。

对于默认的module,其controller的类,不需要加module名,如:

在modules/default/controllers/IndexController.php 中的内容为:

class IndexController extends Zend_Controller_Action
{
    public function init()
    {
        /* Initialize action controller here */
    }


    public function indexAction()
    {
        // action body
    }
}

其他的module,controller的类,需要添加module名。

modules/test/controllers/LeController.php

class Test_LeController extends Zend_Controller_Action
{
    public function init()
    {
        /* Initialize action controller here */
    }


    public function indexAction()
    {
        // action body
    }
}


 类似资料:

相关阅读

相关文章

相关问答