如何使用CodeIgniter在HMVC上的模块文件夹之外加载模块? [英] How to load a module outside modules folder on HMVC with CodeIgniter?

查看:143
本文介绍了如何使用CodeIgniter在HMVC上的模块文件夹之外加载模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为我没有找到它在网上的任何其他地方,我希望我不是问一个愚蠢的问题。



所以我有我的应用程序的这种结构:

 我的APP 
| _
控制器
| _
模块
| _
bar
| _
foo
| _
查看

我可以使用以下代码在foo的视图中加载bar模块:

  ;?php echo Modules :: run('bar / bar / index'); > 

但是我无法使用上面的代码在MyAPP视图上加载同一个模块。 >

我缺少什么?谢谢!

解决方案

我在CI模块文件夹之外的所有控制器上扩展CI_Controller而不是MX_Controller。希望这有助于别人。


Since I didn't find it anywhere else on the net, I hope I'm not asking a stupid question.

So I have this structure on my app:

My APP
|_
  Controllers
|_
  Modules
  |_
    bar
  |_
    foo
|_
  Views

I can load the bar module on the foo's views using this code:

<?php echo Modules::run('bar/bar/index'); ?>

But I'm unable to load the same module on MyAPP views using the code above.

What am I missing? Thanks!

解决方案

Silly me, I was extending CI_Controller instead of MX_Controller on all my controllers outside the modules folder. Hope this helps someone else.

这篇关于如何使用CodeIgniter在HMVC上的模块文件夹之外加载模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆