Welcome Guest, Not a member yet? Register   Sign In
Loading module in another method doesn't work - hmvc wiredesignz

(This post was last modified: 04-21-2016, 04:15 AM by happyape.)

I have setup Wiredesignz HMVC in a fresh CI 3 installation.

I have a controller in Modules/Commonweb/Commonweb/showprofile

I can access showprofile method via mydomain.name/commonweb/showprofile fine because (module directory name and controller names are the same)

Within that Commonweb controller I have another method called myprofile which I access using mydomain.name/commonweb/myprofile

Currently both of these method load separate view files which have almost identical code

So I thought I make use of HMVC features by calling the myprofile method in showprofile method using the format below.

PHP Code:
/** module and controller names are different, you must include the method name also, including 'index' **/
modules::run('module/controller/method'$params, $...);

/** module and controller names are the same but the method is not 'index' **/
modules::run('module/method'$params, $...);

/** module and controller names are the same and the method is 'index' **/
modules::run('module'$params, $...); 

PHP Code:
Class Commonweb extends MX_Controller
   public function __construct()
   public function showprofile()
   public function myprofile()
       //fetch user data and show profile

But I just get a blank page. I tried turning on the debug messages but nothing much there.

What am I doing wrong?

You load the module then call the method in it:

PHP Code:

Just an example.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

No that's not what I am trying to achieve.

I think you have to play with config/routes.php

Theme © iAndrew 2016 - Forum software by © MyBB