fesan Posted April 6, 2009 Share Posted April 6, 2009 I'm making a config file for a quite big "program" I'm making. With the config i want to set some variables and functions that i just can include whenever i need them. Can I in some way just include one part of the config file insted of the whole thing? I have just started to make it and to use it so it isn't that big yet but as I develop the config file will be quite big and it is useless for the users to process all the info that is not needed for that exact page. Link to comment https://forums.phpfreaks.com/topic/152858-config-file/ Share on other sites More sharing options...
phil88 Posted April 6, 2009 Share Posted April 6, 2009 You can't just include parts of a single file. I'd recommend breaking the file up into smaller files that you can include as and when you want. For example, /config/db.php = All the database configuration variables and functions /config/user.php = All the user specific configuration variables and functions etc. Link to comment https://forums.phpfreaks.com/topic/152858-config-file/#findComment-802760 Share on other sites More sharing options...
fesan Posted April 6, 2009 Author Share Posted April 6, 2009 I have the DB info in separate files already. If it doesn't work it doesn't work... Thanks! Link to comment https://forums.phpfreaks.com/topic/152858-config-file/#findComment-802769 Share on other sites More sharing options...
laffin Posted April 6, 2009 Share Posted April 6, 2009 But if u got some good coding skills ya can make it a bit more dynamic. I have built several module loaders, based on my needs. One module loader, which is the root of the site, just processes pages based on the pages db entry. A Simple module loader, I wrote for QuickPHP (Lightweight web server primarily for testing/debugging php). processed modules and the global environment variables, as well as providing a log for. but its all about wut u need, and how u wish to load the modules. As phil said, its all about seperating the different pieces, than either load them manually, or develop a system for loading the pieces. Link to comment https://forums.phpfreaks.com/topic/152858-config-file/#findComment-802786 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.