CodeIgniter Forums
autoload.php is not loaded in development config directory [solved] - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: autoload.php is not loaded in development config directory [solved] (/thread-40320.html)

Pages: 1 2


autoload.php is not loaded in development config directory [solved] - El Forum - 04-05-2011

[eluser]Zaher Ghaibeh[/eluser]
hi:
am using the new version 2.0.1
i have created a 'development' directory under the 'config' directory, i have included the following files :
1- config.php
2- database.php
3- autoload.php

the first two files loaded as normal but the third file (autoload) is not loaded at all ..

i have searched the user_guide but i didn't find which files can be loaded from subdirectory and which not ..
so is this a bug ?
or am doing something wrong ?
-------------------
for all of you check this link : http://alakkad.me/blog/codeigniter-environment/
and my second comment ..

thanks


autoload.php is not loaded in development config directory [solved] - El Forum - 04-05-2011

[eluser]Zaher Ghaibeh[/eluser]
according to one of the comment on this http://codeigniter.uservoice.com/forums/40508-codeigniter-reactor/suggestions/1356605-multiple-environment-support-built-in?ref=comments .
the autoload.php
"Matthew Johnston
This doesn't work with the autoload config files. Not a huge problem but I would like all the config files to be loaded specific for the environment."
this is not a bug ...

but dont you think that autoload must work the same ??


autoload.php is not loaded in development config directory [solved] - El Forum - 04-05-2011

[eluser]Zaher Ghaibeh[/eluser]
i have just solve it Big Grin
edit your 'Loader.php' file and replace this line 976:
function _ci_autoloader()
{
include_once(APPPATH.'config/autoload'.EXT);
with this :
function _ci_autoloader()
{
if(file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload'.EXT)){
include_once(APPPATH.'config/'.ENVIRONMENT.'/autoload'.EXT);
}else{
include_once(APPPATH.'config/autoload'.EXT);
}


autoload.php is not loaded in development config directory [solved] - El Forum - 04-05-2011

[eluser]InsiteFX[/eluser]
You should not be editing any core files!

If you need to make changes you have to extend the CI core files!

Ask yourself this, what will happen to your modified loader.php file when you upgrade CodeIgniter?

Code:
class MY_Loader extends CI_Loader {

}
Place in application/core

InsiteFX


autoload.php is not loaded in development config directory [solved] - El Forum - 04-05-2011

[eluser]Zaher Ghaibeh[/eluser]
will your solution is far more better than mine, but dont you think they have to add it to the core ?
since 2.0.2 has added the ability to load constants.php from a development/production directory.

any way i will digg more to see how can i do it without editing the core ..


autoload.php is not loaded in development config directory [solved] - El Forum - 04-06-2011

[eluser]InsiteFX[/eluser]
Did you report it to the Reactor Team on Bitbucket?

If it's a BUG then it needs to be Report, I just Reported one.

I showed you how to do it above.

InsiteFX


autoload.php is not loaded in development config directory [solved] - El Forum - 04-06-2011

[eluser]Zaher Ghaibeh[/eluser]
my friend add it there as an enhancement i dont think its a bug since the feature is new ..


autoload.php is not loaded in development config directory [solved] - El Forum - 04-06-2011

[eluser]InsiteFX[/eluser]
This is the Enhancement I reported!

If you look at the CodeIgniter User Guide on the Config Class the whole document is backwards!

Code:
// this is wrong!
$this->config->load('filename');

// it should be like this!
$this->load->config('filename');

InsiteFX


autoload.php is not loaded in development config directory [solved] - El Forum - 04-06-2011

[eluser]Zaher Ghaibeh[/eluser]
thats good ..
nice catch ..


autoload.php is not loaded in development config directory [solved] - El Forum - 04-06-2011

[eluser]Zaher Ghaibeh[/eluser]
[quote author="InsiteFX" date="1302087834"]Did you report it to the Reactor Team on Bitbucket?

If it's a BUG then it needs to be Report, I just Reported one.

I showed you how to do it above.

InsiteFX[/quote]

i found this : https://bitbucket.org/ellislab/codeigniter-reactor/changeset/bd59b4fe50d6 its look like they still need many code in the core