
July 13th, 2008, 10:37 AM
|
|
Registered User
|
|
Join Date: Jul 2008
Posts: 1
Time spent in forums: 9 m 27 sec
Reputation Power: 0
|
|
Recommendations on keeping PHP/JS in sync
I am planning a rather large site that will use PHP5 and JavaScript. It will also be using the CodeIgniter MVC framework.
I wanted to find from some other professionals what they have found to be the best way to keep configuration data synced between JavaScript and PHP. Specifically I would like to keep prices for the various services the site offers in some sort of configuration file, and have JavaScript and PHP both able to access that configuration (so if something changes I don't have to modify 2 different files - one for JavaScript and one for PHP).
I have seen some methods here that have PHP just echo out JS tags such as <script>MyConfig.foo = 'bar';</script> but I feel like that is a bit sloppy and there may be a better way. Due to the site's size I am more concerned about keeping the code organized and unobtrusive than a few milliseconds of performance time.
Does anyone have any recommendations of solutions they have used or a reference to something that may help me out? Thanks for the help!
|