本文介绍了码信号+ HMVC交叉模块呼叫控制器→方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



添加到文档中。

我把所有的头发都关掉了...正在搜索每一个线程,如果有人可以指点一个工作示例, :


I am pulling all my hair off... Have been searching every thread, would appreciate if someone can point me to a working example.

Accroding to the doc: https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvcI can call another module->controller using

modules::run('module/controller/method', $params);
modules::load('module/controller/method', $params);
or
$this->load->module('module/controller');
$this->controller->method();

Problem: the "method()" is never called. only constructor of the controller is called every time.

The objective is to build self-contained MVCs as module and use by other controllers.But no matter what I do, it only calls the constructor, method is not called.I started using HMVC a few weeks ago, did I miss something in the doc or it is not used this way?
Here is the setup:

modules
  |--ztest1
  |   |--controller/c1.php
  |--ztest2
      |--controller/c2.php

class C1 extends MX_Controller {
  function __construct() {
    parent::__construct();
  }
  function index () {
    Modules::run('ztest2/c2/testc2/');
    //Modules::load('ztest2/c2/testc2/');
    //$this->load->module('ztest2/c2/testc2/');
    //$this->c2->testc2();
  }
}

class C2 extends MX_Controller {
  function __construct() {
    parent::__construct();
    echo __FILE__." // ".__CLASS__."/".__FUNCTION__.PHP_EOL;
  }
  function testc2(){
    echo __FILE__." // ".__CLASS__."/".__FUNCTION__.PHP_EOL;
  }
}

output:
/app/modules/ztest2/controllers/c2.php // C2/__construct

additional note: no error or warning with the script. It just quietly calls the constructor.

解决方案

This HMVC works well for me. I'm working on a project using this HMVC now.Just edit third_party/MX/Modules.php as shown in this link below and tell me the response.

https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/pull-request/5/return-error-messages-instead-of-logging/diff

这篇关于码信号+ HMVC交叉模块呼叫控制器→方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-14 03:46