zend framework modules

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
    }
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值