Kri*_*ndt 24
我知道有两种方法:
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);
?>
Run Code Online (Sandbox Code Playgroud)
2)直接从模板index.php中删除js文件:
<?php unset($this->_scripts['/media/system/js/mootools-core.js']); ?>
Run Code Online (Sandbox Code Playgroud)
如果要删除Joomla添加的所有脚本,包括内联脚本,最快的方法是:
$this->_script = $this->_scripts = array();
Run Code Online (Sandbox Code Playgroud)
在该<head>部分上方的模板文件中的任何位置添加它.