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

[eluser]Mr. Pickle[/eluser]
Hi Wiredesignz,

Thanks for your quick reply!

If I show a 404 the visitor will see a 404 while I just want CI to ignore the module in the process where CI looks for a module in the modules/ directory based on the uri (don't know the official term for this Big Grin)

I'll explain my problem further:
I now have a newly developed module called guestbook in the modules/ directory.
I load this module via a view partial:
Code:
<?=Modules::run('controller/method');?>
No problems so far.....

Now one of my sites just got a page called guestbook with the following full url:
http://www.mydomain.com/guestbook

Now the problem starts. I use a single controller 'page' (module page within the modules/ dir) handling all my requests. While I want CI to load this controller and handle the requests as it would do if I had no module called guestbook it only shows the module (which is set-up as a partial) Normal behaviour but not for me in this set-up Wink
Of course I DO want to load this module this way if I use the view partial method of calling it (and not have CI load the full page guestbook)

Hope I managed to explain it a little, if not feel free to ask for more info Wink
#62

[eluser]Mr. Pickle[/eluser]
I think I've solved it.
I put all the logic of getting the page stuff from the database (not only content pages but EVERY page) in the page controller within the modules/.

I now put all this logic in a MY_controller so that this logic is not skipped whatever module is loaded (all module controllers extend this MY_Controller)
#63

[eluser]wilso417[/eluser]
MX_Router::fetch_module() only returning 'last module controller loaded' creates a problem with loading/using multiple language files as well.

This seems to be a pretty big bug if you want to use HMVC in a non-linear fashion of just load/use controller, load/use controller, etc.
#64

[eluser]wiredesignz[/eluser]
@wilso417, It is not a bug. The fetch_module() method does the job it was designed to do.

If you care to look you'll see that each controller loader object stores the correct module name.

If you require more functionality, write it yourself.
#65

[eluser]wilso417[/eluser]
I'm sorry, it just seemed like a bug, I did not mean to offend. It seemed like a bug because I thought this situation would be possible:

class Test2 extends MX_Controller {

public function index() {

$this->lang->load('test2');
echo $this->lang->line('test_me');
}
}

class Test1 extends MX_Controller {

public function index() {

$this->load->module('test2');
$this->test2->index();

$this->lang->load('test1');
echo $this->lang->line('test_this');
}
}

where the language files are in their respective modules folder. This will not work because lang is looking in the test2 folder when i try to load 'test1' language file.
#66

[eluser]wilso417[/eluser]
I think the issue is, that 'lang' is a library. Libraries have no way of knowing what module called it as far as I can tell.
#67

[eluser]wilso417[/eluser]
In Lang.php line 55 changing to:

$_module = CI::$APP->load->_module; (where _module was changed to public in Loader.php)

does not fix the situation either, this will only look in 'test1'. Am I correct in assuming there is no way for a library to know what controller called it?
#68

[eluser]wiredesignz[/eluser]
@wilso417,
In Modular extensions CI::$APP is the application (super) object. Not a controller.

Try passing $this->load->_module when you load the language file in the lang->load() parameter?
Code:
$test1 = $this->load->_module;
$this->lang->load($test1.'/test_this');


$test2 = $this->load->_module;
$this->lang->load($test2.'/test_me');
#69

[eluser]wilso417[/eluser]
Thank you @wiredesignz. I have been doing that method as a workaround. I was just hoping there was a better solution, that there was a way for a library to know what module called it, that is all. I have not found a way though and I think the way you showed is the only solution.

Thank you again for all your hard work on MX. I wish they would make it part of CI. If it wasn't for this extension I would have gone with Kohona for my CMS project.
#70

[eluser]fewds[/eluser]
I would like to delete the default controllers, models, views folders located under application. I have tried and as soon as I delete the default controllers folder everything seems to go nuts (Your default controller cannot be found....blah....blah), would you happen to know of a quick fix to make it work again? I can get it to work by leaving a blank controllers folder under application (but thats ugly!) so I assume somewhere in CI 2.0.2 its making sure this folder exist before proceeding. However I have looked everywhere and finally gave in and figured I asked on here since I believe someone else might have tried this before as well. Thanks for your time and again thanks for making CI HMVC capable!

Steven.




Theme © iAndrew 2016 - Forum software by © MyBB