Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Exclude certain HMVC modules to load by uri (only load them via view partial)
#1

[eluser]Mr. Pickle[/eluser]
I'll try to explain my problem as good as possible.

I use a single controller (set as default_controller AND 404_override in the routes config) which basically handles all my requests. Based on the current url it looks up the page in my database (which template, css, js, blocks to load)

Within some of my view partials I load a module using the HMVC call:
Code:
<?=Modules::run('controller/method');?>

It worked perfect until I had a module with the same name that one of my url's got assigned:
Url: http://mydomain.com/guestbook
HMVC Module name: guestbook

In this case the HMVC system loads the guestbook HMVC module controller and not my page controller. Normal behaviour but I would like to load mosts (theoretically all but my default controller) modules to only load using the HMVC call
Code:
<?=Modules::run('controller/method');?>
and not based on the current url.

I don't know if this is possible?
I can -if necassary- put my default controller in the 'normal' CI structure and not in the HMVC structure (modules/ dir) so that I can simply have all HMVC modules ignore the url's.

The only solution I found to solve my problem is to rename my modules so they will normally never interfere with my url's (nasty!)
#2

[eluser]Mr. Pickle[/eluser]
-updated my main topic so this reply is a little outdated-
#3

[eluser]Mr. Pickle[/eluser]
Solved it, not by achieving what I wanted in this post, but by moving the logic where I decide what page to load to a MY_Controller, instead of having this logic deep within a HMVC module.




Theme © iAndrew 2016 - Forum software by © MyBB