13
A
回答
23
有兩種方法,我知道的:
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 )直接從你的模板的index.php刪除js文件:
<?php unset($this->_scripts['/media/system/js/mootools-core.js']); ?>
0
您只需編輯這些插件代碼來刪除這些文件。或者在不需要的情況下卸載這些插件。
-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>
部分模板文件這在任何地方。
相關問題
- 1. 從文件刪除不需要的值
- 2. 如何從txt文件中刪除不需要的空間
- 3. 如何從解析文件中刪除不需要的項目
- 4. 如何從maven項目中刪除不需要的文件
- 5. 使用JavaScript從HTML頁面中刪除不需要的字符
- 6. 從html頁面刪除不需要的腳本和iframe
- 7. 如何在Joomla中需要aws_sdk文件?
- 8. 從Woocommerce中刪除JS文件產品編輯頁面
- 9. 從頁面中刪除css和js文件
- 10. 從WooCommerce產品頁面刪除不需要的JavaScript產品頁面
- 11. MSBuild刪除不需要的文件
- 12. MPDF刪除不需要的文件夾
- 13. 需要刪除與JS/CSS
- 14. 如何在完全加載之前從一個頁面中刪除js文件
- 15. 從子頁面的MASTER頁面中刪除JS SCRIPT
- 16. 如何從R中的excel文件中刪除不需要的列?
- 17. php/js - 如何在頁面unloades時刪除文件?
- 18. 如何從文本文件中去除不需要的行
- 19. JS,PLUpload:上傳後不要從隊列中刪除文件?
- 20. 使用cmd文件從PATH中刪除不需要的目錄
- 21. 從PHP Composer依賴關係中刪除不需要的文件
- 22. 從文件夾名稱中刪除不需要的字符
- 23. Excel VBA /宏從.txt文件中刪除不需要的逗號
- 24. 從CSS中刪除不需要的類
- 25. 在Eclipse中,我如何從SVN刪除舊的或不需要的類文件
- 26. 如何刪除(需要的文本),刪除(不需要的文本),並粘貼(所需的文本)在Vim
- 27. Joomla 3「提交文章」頁面 - 如何刪除「訪問級別」
- 28. 刪除首頁joomla中的文章2.5
- 29. 如何使用Python從pdf文件中刪除頁面?
- 30. 如何從Wordpress中刪除#One頁面
如果一個插件需要一個javascript文件,如果你刪除它,你可能會遇到麻煩。移除插件本身不是更好嗎?這也應該刪除JavaScript文件。 – Okonomiyaki3000