CodeIgniter Forums
Modular Separation - PHP5 (Modules) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Modular Separation - PHP5 (Modules) (/showthread.php?tid=20208)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33


Modular Separation - PHP5 (Modules) - El Forum - 10-29-2009

[eluser]Zandy[/eluser]
@wiredesignz : also tried to change uri_protocol and nothing ....


Modular Separation - PHP5 (Modules) - El Forum - 10-29-2009

[eluser]wiredesignz[/eluser]
[quote author="Zandy" date="1256841092"]@wiredesignz : my default controller in routes.php is "welcome".... ($route['default_controller'] = "welcome"Wink[/quote]

Yes but now you have no welcome controller so the default_controller setting is incorrect.

The controller has become the mymodule/welcome controller!

Modules function almost like sub-directories would normally, I recommend you check the CodeIgniter user guide.


Modular Separation - PHP5 (Modules) - El Forum - 10-29-2009

[eluser]Zandy[/eluser]
Works but ... if I add a module called "truck" and put inside a controller called "ford", by placing the following uri
http://localhost/ci_test/index.php/truck/ford
and.... the default controller runs... ? not ford controller.

multiple modules support ???

my actual struct folder.

Quote:modules
--mymodule
--controllers
--welcome.php
--truck
--controllers
--ford.php

ever runs default controller..!

thank @wiredesignz :-)


Modular Separation - PHP5 (Modules) - El Forum - 11-11-2009

[eluser]Milos Dakic[/eluser]
Can a module have a config folder for its own settings? I wanted to know since I want to use a single route.php file per module, that way each module has its own route settings.


Modular Separation - PHP5 (Modules) - El Forum - 11-11-2009

[eluser]wiredesignz[/eluser]
Yes modules may contain a config/routes.php file.

The main difference from application routes, is that you set a default controller for a module like so:
Code:
$route['module'] = 'controller';



Modular Separation - PHP5 (Modules) - El Forum - 11-11-2009

[eluser]goran_zg[/eluser]
Sorry for this question, but what is the real difference between HMVC and this. If I only need to use modules not to have them in hierarchical order(not been able to get data from child to parent) this would be better?

how much is the performance difference?

anyway, great work, smth like this or this should really be in next CI release


Modular Separation - PHP5 (Modules) - El Forum - 11-11-2009

[eluser]wiredesignz[/eluser]
[quote author="goran_zg" date="1258010483"]... If I only need to use modules not to have them in hierarchical order ... this would be better ...[/quote]


You are 100% correct. Thanks for explaining. Wink


Modular Separation - PHP5 (Modules) - El Forum - 11-12-2009

[eluser]goran_zg[/eluser]
Sorry for another question. I installed it on my CMS. And I get error:

A PHP Error was encountered
Severity: Notice
Message: Undefined property: Frontend::$MFrontend
Filename: controllers/frontend.php
Line Number: 35

This is before I even separate my code in modules. In the line I call some method from model $this->MFrontend->getMenuItem(.....);
the same goes on every controller...

please help, thnx

EDIT, just to add php_error.log line for the try.
[12-Nov-2009 19:15:39] PHP Fatal error: Call to a member function getMenuItem() on a non-object in /Applications/MAMP/htdocs/webox/application/controllers/frontend.php on line 35

Hope it helps couse I really want to use this module approach.


Modular Separation - PHP5 (Modules) - El Forum - 11-12-2009

[eluser]wiredesignz[/eluser]
@goran_zg, Read the codeigniter user guide regarding naming conventions and when not to use CamelCase!

Modular Separation requires that you use these naming conventions also.


Modular Separation - PHP5 (Modules) - El Forum - 11-12-2009

[eluser]goran_zg[/eluser]
Idiot me, I wrote the whole cms wrong...... Now pain work, and testing then Undecided

thnx

EDIT
Just corrected some function and this looks and works great really Smile

Ok, another stupid q. I have a template.php file in normal view/folder it contains basic html and calls $this->load->view(smth);

and $this->load->view($main); // this is variable what lets say screen to load and I think it looks in folder of template not modules for file defined in there how can I make it look in modules/../view for that.

thnx