Posted By

jose_506 on 09/16/11


Tagged

php page library Switch current


Versions (?)

Switch libraries current page


 / Published in: PHP
 

  1. <?php
  2.  
  3. function switchlibrary($controllerName = null){
  4. if(isset($controllerName)){
  5.  
  6. $styles;
  7. $scripts;
  8.  
  9. $returnScripts='';
  10. $returnStyles='';
  11.  
  12. $jquery = 'public/js/jquery.min.js';
  13. $cufon = 'public/js/cufon.yui.js';
  14. $quicksand ='public/js/quicksand.js';
  15. $custom = 'public/js/custom.js';
  16. $fancybox = 'public/js/fancybox/jquery.fancybox-1.3.0.pack.js';
  17. $slider = 'public/js/jquery.anythingslider.js';
  18.  
  19. $style = 'public/css/style.css';
  20. $slidercss = 'public/css/anythingslider.css';
  21. $fancyboxcss = 'public/js/fancybox/jquery.fancybox-1.3.0.css';
  22. $twitter = 'public/js/twitter.min.js';
  23.  
  24. switch($controllerName){
  25. case 'Home':
  26. $scripts=array($jquery,$cufon,$quicksand,$custom);
  27. $styles=array($style);
  28. break;
  29. case 'Portfolio':
  30. $scripts=array($jquery,$cufon,$quicksand,$fancybox,$slider,$custom);
  31. $styles=array($style,$slidercss,$fancyboxcss);
  32. break;
  33. case 'Social':
  34. $scripts=array($jquery,$cufon,$quicksand,$twitter,$custom);
  35. $styles=array($style,$slidercss,$fancyboxcss);
  36. break;
  37. case 'Skills':
  38. $scripts=array($jquery,$cufon,$quicksand,$custom);
  39. $styles=array($style);
  40. break;
  41. case 'Contact':
  42. $scripts=array($jquery,$cufon,$quicksand,$custom);
  43. $styles=array($style);
  44. break;
  45. }
  46.  
  47. for($sc=0;$sc<count($scripts);$sc++){
  48. $returnScripts.=link_script($scripts[$sc]);
  49. }
  50.  
  51. for($st=0;$st<count($styles);$st++){
  52. $returnStyles.=link_tag($styles[$st]);
  53. }
  54.  
  55. return $returnStyles.$returnScripts;
  56. }else{
  57. return false;
  58. }
  59. }
  60.  
  61. ?>

Report this snippet  

You need to login to post a comment.