Reputation: 2201
I'm coding a theme and i want to create a configuration file (maybe ini) to control variables in the theme For example, I want to have a file with simple content like this
navigation: 1;
site_name: MYSITE;
^ dunno if the syntax is right...just an example
And then i want to use that file to show the content stored in those variables.
for example :
shows the value entered in the file i also want to show/hide specific content based on the Boolean value entered in the value (navigation: 1 or 0) something likeI hope i'm understandable. I'm a noob in PHP :'>
Upvotes: 0
Views: 791
Reputation: 1231
I moved away from .ini files when I discovered json. Makes everything so easy.
$filePath = "/var/www/config.json";
// Puts the config into an array
$config = json_decode(file_get_contents($filePath));
// Saves array back to config file
file_put_contents($filePath, json_encode($config));
Upvotes: 2