In the spirit of modularization

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

In the spirit of modularization

Post by alex.barylski »

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 :)
GRemm
Forum Newbie
Posts: 17
Joined: Fri Jul 08, 2005 3:37 pm
Location: California
Contact:

Post by GRemm »

Code? It would help greatly towards understanding your problem more clearly.
Post Reply