addStylesheet() public method

Locate stylesheet file and add it to HTML's head section.
public addStylesheet ( string $file, string $ext = '.css', string $locate = 'css' )
$file string
$ext string
$locate string
Example #1
0
 function addStylesheet($file, $ext = '.css', $template = false)
 {
     $url = $this->api->locateURL('css', $file . $ext);
     if (!$this->atk4_initialised || $template) {
         return parent::addStylesheet($file, $ext);
     }
     parent::addOnReady('$.atk4.includeCSS("' . $url . '")');
 }
Example #2
0
File: jUI.php Project: respond/atk4
 function addStylesheet($file, $ext = '.css', $template = false)
 {
     /*
       if(file_exists($try[]=BASEDIR.'/'.($relative_path=$this->js_dir.'/'.$file).$ext)){}   // do nothing, relative_path is set
       elseif(file_exists($try[]=AMODULES3_DIR.'/'.($relative_path=$this->js_dir.'/'.$file).$ext))$relative_path=basename(AMODULES3_DIR).'/'.$relative_path;
       elseif(file_exists($try[]=BASEDIR.'/'.($relative_path=$file).$ext));
       else throw new BaseException("Can't find ($file$ext) (tried: ".join(', ',$try).")");
     */
     $url = $this->api->locateURL('css', $file . $ext);
     if (!$this->atk4_initialised || $template) {
         return parent::addStylesheet($file, $ext);
     }
     parent::addOnReady('$.atk4.includeCSS("' . $url . '")');
 }