How can I load static configuration information

Posted by Goro on Stack Overflow See other posts from Stack Overflow or by Goro
Published on 2010-04-08T17:01:05Z Indexed on 2010/04/08 23:13 UTC
Read the original article Hit count: 289

Filed under:
|
|

In my code, I use JavaScript for UI and PHP for back end. I also use PHP to store application settings and sometimes my UI code needs to access this information. My configuration file looks something like this (config.php):

$resolution_x = 1920;
$resolution_y = 1080;
etc...

When I need to access any of these settings form JavaScript, i simply use

<?php echo ... ?>

to substitute the value directly, but it just doesn't strike me as very robust.

Are they any dangers of doing this that I am not aware of? Is there a better way of doing this?

Thank you,

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about php