Welcome Guest, Not a member yet? Register   Sign In
Modular Extensions - HMVC version 5.4
#51

[eluser]wiredesignz[/eluser]
@osci, Yes thanks, that will be a Reactor and Core CI version conflict too. Reactor is using protected methods. I will update again to use public methods.
#52

[eluser]osci[/eluser]
Thanks for the info wiredesignz.
I am basically using core for my commercial projects.
I'll check it there too and repost.

The vanilla test was on reactor since I wanted to check my projects on reactor too.
I know I might be asking too much but could we have another branch for reactor and another for core?

Thanks again for your contributions.
#53

[eluser]wilso417[/eluser]
Hi wiredesignz, was I wrongly extending MX_Lang or is there not a native way to extend that with HMVC? Also, is there a bug with $this->router->fetch_module() not always returning the correct module in different contexts?
#54

[eluser]eldrinofsoalim[/eluser]
Hi! I'm starting to learn HMVC and I really think that it can do wonders. It might be what I need to actually create an admin-member-non-member website.

I'm just running encountering a problem. It seems there's a problem with calling HMVC from the view. I'm currently following the Net Tuts HMVC: an introduction and application. Let me explain:

Here are the functions:

THE CONTROLLER FUNCTION UNDER "LOGIN" MODULE:

Code:
function cp()  
{  
    if( $this->session->userdata('username') )  
    {  
        // load the model for this controller  
        $this->load->model('membership_model');  
        // Get User Details from Database  
        $user = $this->membership_model->get_member_details();  
        if( !$user )  
        {  
            // No user found  
            return false;  
        }  
        else  
        {  
            // display our widget  
            $this->load->view('user_widget', $user);  
        }  
    }  
    else  
    {  
        // There is no session so we return nothing  
        return false;  
    }  
}

and

THE VIEW UNDER THE "SITE" MODULE:

Code:
<!DOCTYPE html>  
&lt;html lang="en"&gt;  
&lt;head&gt;  
    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;  
    &lt;title&gt;untitled&lt;/title&gt;  
&lt;/head&gt;  
&lt;body&gt;  
    &lt;?php echo modules::run('modules/login/cp');?&gt;  
    <h2>Welcome Back, &lt;?php echo $this->session->userdata('username'); ?&gt;!</h2>  
     <p>This section represents the area that only logged in members can access.</p>  
&lt;/body&gt;  
&lt;/html&gt;

THE PROBLEM:

I can't seem to call cp() from the view using &lt;?php echo modules::run('modules/login/cp');?&gt;. It doesn't produce the user_widget. If I change the function called in the view (i.e. &lt;?php echo modules::run('modules/login/RANDOMFUNCTION');?&gtWink, it don't get an error.

If I remove the "modules" from the path (as in the original code in the article - &lt;?php echo modules::run('login/cp');?&gtWink, I get an error:

Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined property: Login::$session

Filename: controllers/login.php

Line Number: 91

Is there something wrong with the code? I followed the guide to the letter except when I had to edit the module::run call from module::run('login/cp') to module::run('modules/cp') to follow the format specified:

Quote:Format: modules::run('module/controller/action', $param1, $param2, .., $paramN);
#55

[eluser]wiredesignz[/eluser]
@wilso417, MY_Lang should be located in application/core and should extend MX_Lang. The error with CI_Controller needs to be resolved as a separate issue.

MX_Router::fetch_module() returns the name of the last module controller loaded.
#56

[eluser]wiredesignz[/eluser]
@eldrinofsoalim, Don't use the word "modules" use the name of your module. The error with Login::$session needs to be resolved as a separate issue.
#57

[eluser]wilso417[/eluser]
I see, thanks wiredesignz.

Is there any easy way to return or have fetch_module() return the last module being 'used' and not just loaded?
#58

[eluser]pickupman[/eluser]
Just pulled the latest changes for Reactor. I had to add another public var to MX/Loader.php
Code:
public $_ci_classes = array();
#59

[eluser]Mr. Pickle[/eluser]
Hi Wiredesignz, any way I can have the HMVC modules load when calling them from a view partial, but have them ignore the url? Ideally configurable per module.
#60

[eluser]wiredesignz[/eluser]
@Mr. Pickle, Use modules::run('module/controller/method') to load a module from a view partial and add the _remap() method to a controller where you can manage calls from the URL.

Code:
class Partial_controller extends MX_Controller
{
    public function _remap() //trap calls from the URL
    {        
          show_404();        //show page not found
    }

    public function show_view()
    {
         $this->load->view('what_ever');
    }
}




Theme © iAndrew 2016 - Forum software by © MyBB