jQuery dynamic Google CDN with PHP


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. /*
  3. * Put this in your config file
  4. */
  5.  
  6. function jQuery($v){
  7. echo ($v ? "<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/".$v."/jquery.min.js\" type=\"text/javascript\"></script>" : "<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js\" type=\"text/javascript\"></script>");
  8. }
  9.  
  10.  
  11.  
  12. /*
  13. * Put this in all pages
  14. */
  15.  
  16. // Default version
  17. jQuery();
  18.  
  19. // Version specifies
  20. jQuery("1.4.2");
  21.  
  22. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.