Certain Variables I use acrross Javascript and PHP, for example JSON_ON.
I need it set to either 1 on both sides or 0 on both sides…this sets encoding and decoding of structured data.
One way I could implment this is to just have PHP open up the .js file and read the variable.
Is this done? Are there better ways to implement variables across languages?
I only want to have to set the variable in one place, in this case the .js File.
If I think I understand you need to set a constant somewhere? And you need to have both your JS and PHP to be aware of it? I would personally just do it as a PHP config item and then echo the output to the JS file, OR set the
var item = valueat run of your php script.