In the spirit of modularization
Posted: Sat Dec 03, 2005 10:55 am
I have a web application which is composed of several different modules...
PHP, Templates, etc...
One of my templates requires extensive use of Javascript...
No problem...the javascript (which is specific to that template) is embedded as inline script...no SRC="myscript.js"
Here is the problem which I face...
One it's ugly...but more importantly, there are a few confirms and alerts which create a problem regarding moving this code into a seperate JS file instead of PHP...
Those confirms all use GLOBAL language variables...
So I can't easily move those functions into a seperate JS file because then I can include my language GLOBALS
I have considered moving the functions into a myscript.js.php but I would still now have to include the language packs inside this JS file as well...which (under these circumstances would be overkill and annoying to keep updated).
So I ask...how do you suggest I solve this problem?
Keep the code embedded inside the PHP template file? Basically as is...
Or
Assign global JS variables the language text and use those variables in the functions? Problem with that is...some strings concatnate variables so i'm not sure if that would work either...
Or I'm lost for ideas...
Whacha think'
Cheers
PHP, Templates, etc...
One of my templates requires extensive use of Javascript...
No problem...the javascript (which is specific to that template) is embedded as inline script...no SRC="myscript.js"
Here is the problem which I face...
One it's ugly...but more importantly, there are a few confirms and alerts which create a problem regarding moving this code into a seperate JS file instead of PHP...
Those confirms all use GLOBAL language variables...
So I can't easily move those functions into a seperate JS file because then I can include my language GLOBALS
I have considered moving the functions into a myscript.js.php but I would still now have to include the language packs inside this JS file as well...which (under these circumstances would be overkill and annoying to keep updated).
So I ask...how do you suggest I solve this problem?
Keep the code embedded inside the PHP template file? Basically as is...
Or
Assign global JS variables the language text and use those variables in the functions? Problem with that is...some strings concatnate variables so i'm not sure if that would work either...
Or I'm lost for ideas...
Whacha think'
Cheers