在代码点火器 HMVC 中将模块设置为主页


Setting a module as homepage in codeigniter HMVC

今天我开始使用Codeigniter+来自wiredesignz(hmvc(的模块化扩展,我有很多未解决的问题,但目前我只会坚持1。我了解这些模块的工作原理,我想创建一个测试网站,其中有 3 个模块(主页、关于和博客(。

我的文件夹结构 :

Home 
|-controllers
|-models
|-views
About
|-controllers
|-models
|-views
Blog
|-controllers
|-models
|-views

现在的问题:如何使主页模块被视为主页/主页?我尝试使用配置

$config['base_url'] = 'modules/home'; it didn't work 

我尝试了主索引文件中的一些调整,但不幸的是它使我的代码变砖。我尝试了htaccess,但什么都没有.谢谢。

每个模块可能包含一个配置/路由.php文件,其中可以使用以下命令为该模块定义路由和默认控制器:

$route['module_name'] = 'controller_name';

取自wiredesignz。

上面的基兰有点接近。我尝试在实时环境中这样做,但失败了。显然,仅当您的默认模块和默认控制器相同(即家庭(时,这才有效。否则,必须指定模块名称和控制器名称。就我而言,我在默认控制器中指定了模块名称和控制器名称,然后它开始了!
$route['default_controller'] = 'admin/home';
在您的情况下,它将是:
$route['default_controller'] = 'home/controller_name';

它可能会对您有所帮助,如果您仍在等待答案,请将默认控制器更改为"家庭"控制器。在配置/路由中.php

$route['default_controller'] = 'home';//home is the controller name of home module.

只需转到您的应用程序''配置''路由.php并将默认控制器更改为所需的模块和控制器:

$route['default_controller'] = '模块/controller_name';