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

(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()
 
   {
 
       parent::__construct();
 
   }
 
   public function showprofile()
 
   {
 
       modules::load('commonweb/myprofile/');
 
   }
 
   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?
Reply


Messages In This Thread
Loading module in another method doesn't work - hmvc wiredesignz - by happyape - 04-21-2016, 04:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB