How to load a module outside modules folder on HMVC with CodeIgniter?

╄→尐↘猪︶ㄣ 提交于 2019-12-12 02:19:00

问题


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!


回答1:


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




回答2:


Well you can do this too

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



回答3:


If you extended the MX_controller in your inside module controller it will automatically render the view from the root view folder files.



来源:https://stackoverflow.com/questions/11256372/how-to-load-a-module-outside-modules-folder-on-hmvc-with-codeigniter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!