That’s great! Thanks wiredesignz. 😊
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
July 02, 2009 12:38am
Subscribe [88]#31 / Oct 20, 2009 12:42am
That’s great! Thanks wiredesignz. 😊
#32 / Oct 21, 2009 7:35am
Modular Separation - PHP5 version 1.07 is attached to this post.
Updated Modules::find() code in line with Modular Extensions - PHP5 version 5.2.27
EDIT:
deprecated file removed
#33 / Oct 21, 2009 12:09pm
Is there a documentation somewhere how to use it?
#34 / Oct 21, 2009 7:36pm
Documentation:
Modular Separation allows you to use modules for code organization in your application.
Modules now comply with CI 1.7.2, Controllers in sub-directories are supported and resources may be cross loaded from other modules.
You should be able to take any CodeIgniter application and place it into a module and it should work without alteration. However routes might need altering to allow for the added separation of a module.
#35 / Oct 26, 2009 7:56am
Does it autoload all config files in the modules config directory?
It seems like my application loads the config files twice.
And looking in the log, the config class and language class is also loaded twice?
And with global XSS filtering on, it filters twice too.
Else, really nice work - i love it!
#36 / Oct 28, 2009 4:23pm
This is my steps:
- extract a fresh CI 1.7.2 to local server and change the base url to respect my installation dir
- hit a base url:
<a href="http://localhost/ci_test/">http://localhost/ci_test/</a>- extract a fresh (Modular Separation 17) and put MY_Loader.php and MY_Router.php in application/libraries
-create a modules folder
-create a “mymodule” folder into modules.
....
application
—->modules
——>mymodule
—->controllers
—->welcome.php
class Welcome extends Controller
{
function __construct() { parent::Controller; }
function index(){ echo 'testing'; }
}i put the following url
and…
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 0
Filename: libraries/MY_Router.php
Line Number: 61
A PHP Error was encounteredSeverity: Notice
Message: Undefined offset: 0
Filename: libraries/MY_Router.php
Line Number: 66
A PHP Error was encounteredSeverity: Notice
Message: Undefined offset: 0
Filename: libraries/Router.php
Line Number: 201
A PHP Error was encounteredSeverity: Notice
Message: Undefined offset: 0
Filename: libraries/Router.php
Line Number: 207
A PHP Error was encounteredSeverity: Notice
Message: Undefined offset: 0
Filename: libraries/Router.php
Line Number: 210
A PHP Error was encounteredSeverity: Warning
Message: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\mod\system\libraries\Exceptions.php:166)
Filename: codeigniter/Common.php
Line Number: 360
404 Page Not FoundThe page you requested was not found.
whats wrong. /???x!?
#37 / Oct 28, 2009 9:46pm
@Zandy, You only need to post the first error. The other errors are caused by the first. Thanks.
Check that you have your default controller set properly and that you are using a uri_protocol setting that works for your server.
In any case I will release a patch to stop that error occuring, but it will not fix a faulty installation setup.
#38 / Oct 28, 2009 9:51pm
@Joakim Kejser, Look again, you will see that the Config and Language objects are initialized twice, they are not loaded twice. This is by design as the original classes are extended and replaced, ready to be used in modules.
Yes, some config files are loaded from modules if they exist.
#39 / Oct 29, 2009 8:18am
Modular Separation - PHP5 version 1.08 is attached to this post.
Patched to prevent missing segment index error instead of page not found.
EDIT:
deprecated file removed
#40 / Oct 29, 2009 10:31am
@wiredesignz : my default controller in routes.php is “welcome”.... ($route[‘default_controller’] = “welcome”;)
one questions!... This directory structure is correct. ???
─system
├───application
│ ├───config
│ ├───controllers
│ │ (I remove welcome.php from here!!)
│ ├───errors
│ ├───helpers
│ ├───hooks
│ ├───language
│ │ └───english
│ ├───libraries
│ ├───models
│ ├───modules
│ │ └───mymodule
│ │ └───controllers
│ │ │ (here welcome.php)
│ │
│ └───views
├───cache
.
.
.
. etc…
<?php
class Welcome extends Controller {
function Welcome()
{
parent::Controller();
}
function index()
{
echo 'Please, enter here !!!!';
}
}
in module folder. only have one folder “controllers”
ahh… i download the latest version (18) .....and now.. show 404 error message..????
greetings..!
#41 / Oct 29, 2009 10:35am
@wiredesignz : also tried to change uri_protocol and nothing ....
#42 / Oct 29, 2009 10:47am
@wiredesignz : my default controller in routes.php is “welcome”.... ($route[‘default_controller’] = “welcome”;)
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.
#43 / Oct 29, 2009 11:36am
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.
modules
—mymodule
—controllers
—welcome.php
—truck
—controllers
—ford.php
ever runs default controller..!
thank @wiredesignz 😊
#44 / Nov 11, 2009 6:58pm
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.
#45 / Nov 11, 2009 7:18pm
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:
$route['module'] = 'controller';