2012-05-21 2 views

답변

23

내가 알고 있는데 두 가지 방법이 있습니다) 당신의 템플릿의 index.php에서 직접 JS 파일을 제거 :

<?php unset($this->_scripts['/media/system/js/mootools-core.js']); ?> 
0

당신은 간단하게 편집 할 수 있습니다 나는 모든 페이지에서 플러그인에게 많은 JS 파일이 포함 된 일부 페이지를 사용했다 이러한 플러그인은 이러한 파일을 제거하는 코드입니다. 필요하지 않은 경우 플러그인을 제거하십시오.

1) (당신이) 플러그인에 그렇게 할 수있는 인스턴스를 가져 문서 객체의 경우와의 js 파일을 제거 :

<?php 
     //get the array containing all the script declarations 
     $document = JFactory::getDocument(); 
     $headData = $document->getHeadData(); 
     $scripts = $headData['scripts']; 

     //remove your script, i.e. mootools 
     unset($scripts['/media/system/js/mootools-core.js']); 
     unset($scripts['/media/system/js/mootools-more.js']); 
     $headData['scripts'] = $scripts; 
     $document->setHeadData($headData); 
?> 

2

-7
**An easiest way to disable mootools/ unwanted javascripts for your site in joomla cms (2.5 version)**(still loads it for your admin) 


**Step-1:** 
Using your favorite file editor, open for edit: 
libraries/joomla/document/html/renderer/head.php 

**Step-2:** check for code in head.php 

// Generate script file links 
foreach ($document->_scripts as $strSrc => $strAttr) 
{ 
// *** start *** // 
$ex_src = explode("/",$strSrc); 
$js_file_name = $ex_src[count($ex_src)-1]; 
$js_to_ignore = array("mootools-more.js","core.js"); // scripts to skip loading 
//skip loading scripts.. 
if(in_array($js_file_name,$js_to_ignore) AND substr_count($document->baseurl,"/administrator") < 1 AND $_GET['view'] != 'form'){continue;} 
// *** end *** // 


**Step-3:** 
Clear cache & refresh page. 


it works for sure. 

For detailed explanation : http://www.inmotionhosting.com/support/edu/joomla-25/302-disable-mootools-in-joomla-25 
+5

코어 파일 수정은 권장되지 않습니다. – betweenbrain

5

는 모든 스크립트를 제거 할 경우 그 조 omla는 가장 빠른 방법이있다, 인라인 스크립트를 포함, 추가 :

$this->_script = $this->_scripts = array(); 

<head> 섹션 위의 템플릿 파일이 어느 곳을 추가합니다.

관련 문제