Example #1
0
 /**
  * load a js like a view
  * SmartLoaderJS try to get this file into the configurated js folder
  * @param string $js_file the js file to load without .js extension
  */
 public function loadView($js_file)
 {
     if (is_array($js_file)) {
         $data = '';
         foreach ($js_file as $js) {
             $file = $this->config->getStaticDirectory() . '/' . $this->config->getTemplatesDirectory() . '/' . $this->config->getDefaultTemplateName() . '/' . $this->config->getJsViewsDirectory() . '/' . $js . '.js';
             $data .= file_get_contents($file) . "\n";
         }
     } else {
         $file = $this->config->getStaticDirectory() . '/' . $this->config->getTemplatesDirectory() . '/' . $this->config->getDefaultTemplateName() . '/' . $this->config->getJsViewsDirectory() . '/' . $js_file . '.js';
         $data = file_get_contents($file);
     }
     $this->js($data);
 }