Context::addJsFile();
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');

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