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

[eluser]wiredesignz[/eluser]
Use the Modules::locations array in MX / Modules.php
#62

[eluser]nfx-nano[/eluser]
Thanks. Another question.

I have this module (dir) structure:

Code:
modules/general/module1
modules/general/module2
modules/etc/module1
modules/etc/module2

How do I show the “general” part in the URL? ie.

Code:
mysite.com/general/module1
mysite.com/general/module2
#63

[eluser]wiredesignz[/eluser]
Sub-modules are not supported.
Module controllers in sub-directories is supported.
#64

[eluser]seanloving[/eluser]
This is my libraries/MX_Controller.php file for CI 1.7 + HMVC 5.2:
Code:
class Application extends Controller
{
    function Application()
    {
        parent::Controller();
    }

    function login()
    {
        $this->load->library('auth');
        $this->auth->login();
    }

Where does this code go when I "upgrade" to 1.7 + 5.3?
#65

[eluser]wiredesignz[/eluser]
Code:
require_once APPPATH.'third_party/MX/Controller.php';

class Application extends MX_Controller
{
    function __construct()
    {
        parent::__construct();
    }

    function login()
    {
        $this->load->library('auth');
        $this->auth->login();
    }

Try that as application/libraries/MY_Controller.php in 1.7.2
#66

[eluser]nfx-nano[/eluser]
[quote author="wiredesignz" date="1284937074"]Sub-modules are not supported.
Module controllers in sub-directories is supported.[/quote]
Yeah, I figured something like that was the case. If I add the sub-modules to the locations array however, they work just fine. The only thing that's troubling me is routing the dir-name to the URL.
#67

[eluser]Phil Sturgeon[/eluser]
[quote author="nfx-nano" date="1284994280"][quote author="wiredesignz" date="1284937074"]Sub-modules are not supported.
Module controllers in sub-directories is supported.[/quote]
Yeah, I figured something like that was the case. If I add the sub-modules to the locations array however, they work just fine. The only thing that's troubling me is routing the dir-name to the URL.[/quote]

You can create multiple module locations but you won't be able to route the URL to those different locations. Locations are just searched in turn, if the module is not in one it goes to the next. No routing takes place to find them.
#68

[eluser]newkiwi[/eluser]
Hi wiredesignz

I note that in http://ellislab.com/forums/viewthread/115465/

You said
Quote:When using Modular Extensions 5.2 the controller and CI are separate objects so the profiler (using CI) will not see a controller class variable unless you specifically pass a reference.

Maybe something like this in your controller constructor

Code:
CI::instance()->data =& $this->data;

I assume this is still the case in 5.3


I hit the same issue in 5.3 + CI2.0 - extended controllers as
MX_Controller -> MY_Controller -> User_controller
with app "global" vars in MY_Controller e.g. $this->data
but cannot access MY_Controller $this->data from User_controller with $this->data or from libraires with $this->ci->data.


Q #1 Is this by design?


Q #2 To work around this I use a "shared" library that I run from User_controller construct to store all global app varies and initialization, [transfered them from MY_Controller]
- this way any extended Controllers like User_Controller and other libraries can access these variables

Is this the way to do it rather than storing global vars in the base (MX and MY) controllers?? ....and the more "theoretically" and "puristically" correct approach??
#69

[eluser]bryantAXS[/eluser]
@newkiwi I'm running into the same issue, what does that library your using to create your global vars ($this->data) look like?
#70

[eluser]maltzurra[/eluser]
I'm using hooks to determine the language to be used. And I need to enable language.php config file application-wide.

Code:
$autoload['config'] = array('language');

Now, the above code does NOT seem to work on application/config/autoload.php. It WORKS on application/modules/controller/config/autoload.php though.

I'm not interested in doing $this->load->config('language') on my base controller. I prefer loading the way I said.

Is it a bug or should it work this way?




Theme © iAndrew 2016 - Forum software by © MyBB