justinede Posted August 17, 2009 Share Posted August 17, 2009 Hey guys, I have been trying to combine my js files into one using php. (reduces http requests) I tried to follow this: http://www.ejeliot.com/blog/72 ^^ That didnt work for me. It just wouldnt load my js. So, I am coming to you guys for help. Anyone know an easy simple way I can combine my js files with php? Quote Link to comment https://forums.phpfreaks.com/topic/170605-solved-combine-js-with-php/ Share on other sites More sharing options...
DEVILofDARKNESS Posted August 17, 2009 Share Posted August 17, 2009 WHy making it so difficult? you can just call js apart from php <?php ... ?> <html> <head> <script type='text/JavaScript'> ... </script> </head> <body> <?php echo "body"; ?> </body> </html> or what do you mean? Quote Link to comment https://forums.phpfreaks.com/topic/170605-solved-combine-js-with-php/#findComment-899858 Share on other sites More sharing options...
deadlyp99 Posted August 17, 2009 Share Posted August 17, 2009 Well i'll tell you something. Even the biggest sites don't do that. If you really want to combine your javascript files, Do a copy and paste Course that won't work out well if you dont pay attention. In addition look at this blog, it was written 2 3/4 years ago. It's more likely to be tailored to a larger dial up base of users then high speed internet. Even if you combine the files... I mean the same amount of data is being downloaded to the client, give or take a kilobyte or two in bandwidth. So why do you need this? Quote Link to comment https://forums.phpfreaks.com/topic/170605-solved-combine-js-with-php/#findComment-899859 Share on other sites More sharing options...
oni-kun Posted August 17, 2009 Share Posted August 17, 2009 Yes, this is an old post. Note that combining the files just wasted internal resources, and your processor will have a double footprint per user. Most browsers slipstream your JS files per each requests, smaller separate files are in most cases faster for client loading purposes. Quote Link to comment https://forums.phpfreaks.com/topic/170605-solved-combine-js-with-php/#findComment-899865 Share on other sites More sharing options...
justinede Posted August 17, 2009 Author Share Posted August 17, 2009 ahhh.. thanks for the explanation guys. i thought it would speed up my site as I have about 7 different js files linked. Quote Link to comment https://forums.phpfreaks.com/topic/170605-solved-combine-js-with-php/#findComment-899874 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.