addInclude() public method

Locate javascript file and add it to HTML's head section.
public addInclude ( string $file, string $ext = '.js' )
$file string
$ext string
Example #1
0
 function addInclude($file, $ext = '.js')
 {
     if (strpos($file, 'http') === 0) {
         parent::addOnReady('$.atk4.includeJS("' . $file . '")');
         return $this;
     }
     $url = $this->api->locateURL('js', $file . $ext);
     if (!$this->atk4_initialised) {
         return parent::addInclude($file, $ext);
     }
     parent::addOnReady('$.atk4.includeJS("' . $url . '")');
     return $this;
 }