Hi, I've got a JavaScript file for users on my web site that they have to tweak by inputing their website's address and their affiliate ID. I want to make the process of downloading the script as easy as possible for my visitors, so I'm wondering if there's a way for me to have visitors enter their websites and their affiliate IDs in two text boxes on my web page and then when they hit Submit it would output a file that they could download and save on their desktops. That means no manually editing the JS file. Can this be done? Thanks for your input, Chris
That can be easily done using any server side scripting language such as php or asp. What does your host support?
Yes my host supports PHP. My code is here http://www.digitalmusictracker.com/featuredmp3player.js The ID at the very top is one of the variables I'd want people to be able to change, along with any reference to their site. So anywhere it says www.digitalmusictracker.com my visitors web address would replace it. Thanks a lot for your help
here is a rought script of how it would be implemented. First remove the first two lines of your js because they are being generated dynamically from the script and save it somewhere on your server. <?php $filename = "/../pathtoyourjsfile"; $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); $size = filesize($filename); fclose($handle); header("Content-type: text/html"); header("Content-Disposition: attachment; filename=featuredmp3player.js"); $modifiedlines = "var affiliate_id= 'digitalmusict-20';\n"."var button_url= 'http://www.digitalmusictracker.com/featuredmp3player-images/buyfromamazon.gif';\n"; $size += strlen($modifiedlines); header("Content-length: ".$size); echo $contents; ?> Code (markup): note that I didn't try the code, so I am not sure if it works correctly. It might need some tweaking