If your file flows as: <?php // stuff
include/require app_cons // stuff ?> <script></script> an easy solution would be to have php write the values of the constants as variables where you have your javascript functions. something like: ... <script> <?php echo "var myConst = " . $my_const; ?> </script> if, however, it is information that you don't want to be easily viewable you would need to use AJAX calls to get the data. Assuming that your app_constants file doesn't have any direct output of its own one option for getting these via ajax would be to put something like: if(isset($_GET) && isset($_GET[*some string used in the AJAX call*])) echo $my_const If you don't want to do that you could load the constants into session variables and then write a small script to access them and then call that from the AJAX script. Maybe some of the smarter guys can give you better details on how exactly to do any of those options if you have questions about them. Aaron On Jan 19, 2011, at 10:21 AM, Merrill Oveson wrote: > List: > > I have an app_constants.php file in the includes directory. > > I have another php files that reads the constants from this file. > This other php file also have javascript in it. > > Is it possible to have the javascript read the constant variables in > the app_constants.php file? > > Thanks > > Merrill > > _______________________________________________ > > UPHPU mailing list > [email protected] > http://uphpu.org/mailman/listinfo/uphpu > IRC: #uphpu on irc.freenode.net _______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
