CodeIgniter Forums
Subfolder in config - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Subfolder in config (/showthread.php?tid=63891)



Subfolder in config - nhatkontum - 12-19-2015

HI! i need help  Smile
I'm have config folder:
/application
 /config
   /forum
   /news
   /members
How to fetch config in (forum, news, members)  Exclamation


RE: Subfolder in config - mr_pablo - 12-21-2015

Config sub folders should be for different server environments and not for splitting up actual config files.

Keep them all in one folder, just name them appropriately. You really should need THAT many additional config files, especially not for different users groups or sections of your site.

See: http://www.codeigniter.com/user_guide/libraries/config.html


RE: Subfolder in config - skunkbad - 12-21-2015

(12-19-2015, 12:34 AM)nhatkontum Wrote: HI! i need help  Smile
I'm have config folder:
/application
 /config
   /forum
   /news
   /members
How to fetch config in (forum, news, members)  Exclamation


If you have a config file located at /application/config/forum/new/old/spagetti.php, then you get it like this:


PHP Code:
$this->config->load('forum/new/old/spagetti'); 


I maintain a website that is very large, and has hundreds of config files. You really do need to organize the config files, or they are difficult to find/edit/use.


RE: Subfolder in config - nhatkontum - 12-21-2015

(12-21-2015, 09:35 AM)skunkbad Wrote:
(12-19-2015, 12:34 AM)nhatkontum Wrote: HI! i need help  Smile
I'm have config folder:
/application
 /config
   /forum
   /news
   /members
How to fetch config in (forum, news, members)  Exclamation


If you have a config file located at /application/config/forum/new/old/spagetti.php, then you get it like this:


PHP Code:
$this->config->load('forum/new/old/spagetti'); 


I maintain a website that is very large, and has hundreds of config files. You really do need to organize the config files, or they are difficult to find/edit/use.
Tongue thanks you ,it worked !
@mr_pablo my config file very long -> make my site slow.
ex : Controller News need config News, not need other config : (forum, member, ...)
... thanks


RE: Subfolder in config - Avenirer - 12-21-2015

Why would a configuration file make your site slow?


RE: Subfolder in config - nhatkontum - 12-22-2015

(12-21-2015, 11:57 PM)Avenirer Wrote: Why would a configuration file make your site slow?

Hi Avenirer! Im know your site and like it, love your tutorials Heart
Now come back to my topic.
In Config contains [ path_views ].
Im convert it (config) to Variable in Views.
AND in Views  load Variable in config. Big Grin
Sorry my english


RE: Subfolder in config - Avenirer - 12-22-2015

Holy mother of Codeigniter... I would ask you why do you access config variables inside your views, but I am afraid...


RE: Subfolder in config - nhatkontum - 12-22-2015

ahh i would like change my forum template.


RE: Subfolder in config - mr_pablo - 12-22-2015

It looks like you are using Config files incorrectly.

Config should not change that much from the News section to the Forum (unless they use separate databases, even then, you do not need to use sub-folders in the config folder, as that should be for the development environments!)

And as stated above, you really should not access config variables in your views...