1

I only use the modules for partial views, they are never routed to directly. Instead I have main controllers inside application/controllers and views inside application/views/ which execute Modules::run($moduleName, $params); This invokes the module and renders fine, when reached.

The problem is none of my routes are calling their application/controller/ methods. Meaning my routing has stopped working entirely and only the homepage defined by my route['default_controller'] works. Because my main template file in application/views calls Modules::run($moduleName, $params) successfully, I can verify the modules and HMVC is working fine independently.

I recently upgrade from CodeIgniter 2 to 3 as well as the Module Extensions - HMVC package from WireDesignz. See the picture for directory struction and relevant files.

enter image description here

@ /application/config/routes.php:

$route['default_controller'] = "dashboardcontroller/index";
$route['playlist(|.+?)'] = "dashboardcontroller/custommethod";

@ /application/controllers/Dashboardcontroller.php (note die() statements):

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class dashboardcontroller extends MX_Controller {

    private $data = array("pagi"=>array(), "me"=>array(), 'errors'=>null);

    function __construct() {
        parent::__construct();
    }
    function index() {
        die("THIS IS THE ONLY THING EVER HIT");
    }   
    function custommethod($moduleName, $params) {
         die("THIS IS NEVER HIT");      
    }
}

When I change Dashboardcontroller.php to extend CI_Controller I get a cascade of errors starting with MX/Base.php re-declaring the CI class.

How can I route URIs to application/controllers and still use Module::run($moduleName, $params)?

E.A.T
  • 848
  • 11
  • 24
  • What do you get using Modules:: in `APPPATH."controllers"` and not in modules directory? If you need `Modules::` static methods just use HMVC way. – Tpojka Apr 01 '16 at 12:42
  • @Tpojka, I created a module from my Dashboardcontroller and routed to it via `default_controller`, but `$this->uri->uri_string()` is still empty and thus nothing reallly works. – E.A.T Apr 05 '16 at 18:36
  • Can you use CI cards for segments such are `(:any)` and `(:num)` in a way? – Tpojka Apr 05 '16 at 20:20

0 Answers0