Placing content in a .js file

3 posts by 2 authors in: Forums > CMS Builder
Last Post: October 26   (RSS)

By MercerDesign - October 25

I am building a site that has background images that are controlled from a .js file, so my question is; how do I place the image upload code in the .js file instead of in the .php file? I have attached the .js file and the area that I need to change is on line 174.

Attachments:

splitex.js 11K

By Dave - October 26

Hi MercerDesign, 

What you can do is try creating a copy of splitex.js and saving it as splitex.php.js.

Then add this line to the very top of the file: 

header("Content-Type: application/javascript");

Followed by any other PHP code you need.  Just make sure when you view source of the .php.js file it's valid js.

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com