Kohana Javascript Helper


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



Copy this code and paste it in your HTML
  1. <?php defined('SYSPATH') OR die('No direct access allowed.');
  2.  
  3. class javascript_Core
  4. {
  5. static protected $scripts = array();
  6.  
  7. static public function add($file)
  8. {
  9. self::$scripts[] = $file;
  10. }
  11.  
  12. static public function render($print = FALSE)
  13. {
  14. $output = '';
  15. foreach (self::$scripts as $script)
  16. $output .= html::script($script);
  17.  
  18. if ($print)
  19. echo $output;
  20.  
  21. return $output;
  22. }
  23. } // End javascript_Core

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.