Multitut
Multitut

Reputation: 2169

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

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!

Upvotes: 0

Views: 1847

Answers (3)

arul selvam
arul selvam

Reputation: 1

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

Upvotes: 0

Muhammad Raheel
Muhammad Raheel

Reputation: 19882

Well you can do this too

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

Upvotes: 1

Multitut
Multitut

Reputation: 2169

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

Upvotes: 1

Related Questions