Welcome Guest, Not a member yet? Register   Sign In
HMVC and controllers
#1

[eluser]MgM Web[/eluser]
Im currently using Modular Extensions - HMVC to implement modules on my site. This is working great until I found out something weird.

Looks like the HMVC takes controll of the default controllers. I am trying to add a new controller in a subfolder "system/application/controllers/subfolder/my_controller.php". But when I try to acces this page using "http://www.mysite.com/subfolder/my_controller" I get an 404 Page nit found error.

But if i create the same file under modules using "system/application/modules/subfolder/controllers/subfolder.php" the page is showing correctly.

Is this the way it is supposed to work? Do I have to create the new controllers inside the modules structure or am I missing something?
#2

[eluser]wiredesignz[/eluser]
Modular Extensions does not use application/controllers subfolders, the theory being that a module is better used for file organization.

However application/controllers subfolders can be added to the file search very easily, if you really need this feature.
#3

[eluser]MgM Web[/eluser]
Ok, so when im using modules I am supposed to add new controllers inside the modules folder and not use the controllers folder? This is my structure at the moment.

Controllers:
application/controllers/welcome.php

Modules:
application/modules/menu_module/controllers/menu_module.php
application/modules/news_module/controllers/news_module.php

The menu and news are partial views that I use inside my view in the frontpage (welcome.php).
Next I am going to create a subpage "http://www.mysite.com/subpage". Normally I would create a new cotroller like this:

application/controllers/subpage.php

But this is not working, am I supposed to use the modules folder like this:

application/modules/subpage/controllers/subpage.php
#4

[eluser]wiredesignz[/eluser]
Yes application/controllers will work properly. Just not controllers in subfolders as explained above.
#5

[eluser]MgM Web[/eluser]
Ok, sorry for these noobish questions, but I am trying to understand.

I figured it out, creating a controller like this application/controllers/subpage.php is working correctly.
But "application/controllers/subfolder/subpage.php" - "http://www.mysite.com/subfolder/subpage" is not working as you explained. In this case do I have to create "application/modules/subfolder/controllers/subfolder.php" and then put a method inside "subfolder.php" called "subpage()"? Or what is the suggested solution?
#6

[eluser]wiredesignz[/eluser]
The URL segments are organised like this:

for normal application controllers OR where module controller_name is the same as module_name.

index.php/{controller_name}/method/data

where module controller_name is not equal to module_name.

index.php/{module_name}/{controller_name}/method/data
#7

[eluser]MgM Web[/eluser]
Ok, think I got a hold of it now.. But now it does not look like POST/GET DATA are passed on to the controllers/modules. Is this a known problem?
#8

[eluser]wiredesignz[/eluser]
There are no issues with data being passed to a module controller. $_POST/$_GET are both sanitized by the input class, $_GET is erased unless you enable query_strings, that may be your problem.
#9

[eluser]MgM Web[/eluser]
Ok, thank you wiredesignz it was really my mistake. In my form on the input/text fields I did only have ID and not the rquired name attribute.

Consider this solved, and thank you for your response.
#10

[eluser]woopsicle[/eluser]
[quote author="wiredesignz" date="1213509903"]Modular Extensions does not use application/controllers subfolders, the theory being that a module is better used for file organization.

However application/controllers subfolders can be added to the file search very easily, if you really need this feature.[/quote]

Hi wirezdesignz, can you share how to add a subfolder to the file search? I want to have subfolders in /application/controllers/ without ME thinking that it is a module.

Any help is appreciated - I have had a look through the ME code but would rather not hack away, so thought it would be best to ask you first.




Theme © iAndrew 2016 - Forum software by © MyBB