Context::addJsFile();

정의위치

./classes/context/Context.class.php

용도

애드온이나 모듈 php 파일에서 사용할 수 있습니다.

모듈이나 애드온에서 js 파일을 기본적으로 불러올 때 사용합니다.

정의내용

addJsFile

function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)
{
   if($isRuleset)
   {
      if(strpos($file, '#') !== FALSE)
      {
         $file = str_replace('#', '', $file);
         if(!is_readable($file))
         {
            $file = $autoPath;
         }
      }
      $validator = new Validator($file);
      $validator->setCacheDir('files/cache');
      $file = $validator->getJsPath();
   }

   is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
   $self->oFrontEndFileHandler->loadFile(array($file, $type, $targetie, $index));
}

사용예제

./addons/shortcut/shortcut.addon.php 내용 중

Context::addJsFile('./addons/shortcut/js/shortcut.js');

 

이온디

profile
이온디는 라이믹스를 비롯한 다양한 CMS의 시드뱅크를 꿈꿉니다. 여러분들이 사랑하는 웹소스를 언제든지 사용할 수 있게 하기 위해 이온디는 매일 소스코드를 유지보수하고 있으며, 언제든지 다운로드할 수 있는 소스마켓을 운영하고 있습니다.

#XE마켓 - 이온디스토어
https://eond.com/xemarket/

# XE/라이믹스 단톡방을 운영 중입니다. (비번: 2022)
https://open.kakao.com/o/giaKKnl

# XE/라이믹스 생활코딩 모듈 강좌입니다.
https://opentutorials.org/module/3774
  • profile
    js뿐만 아니라 CSS도 가능합니다.
  • profile

    룰셋 등 특별한 경우가 아니면 CSS, JS 가리지 않고 Context::loadFile()을 사용하는 것이 좋습니다.
    어차피 내부적으로는 똑같은 곳으로 전달됩니다.

  • ?
    룰셋 넣을때 사용하는 함수군요~