我在这里使用代码
<head>
...
<?php
$user =& JFactory::getUser();
if ($user->get('guest') == 1) {
$headerstuff = $this->getHeadData();
$headerstuff['scripts'] = array(); $this->setHeadData($headerstuff);
}
?>
<jdoc:include type="head" />
</head>
但是当运行代码是模板加载所有 javascript 时,如何修复它删除模板 joomla header 中的所有 javascript
最佳答案
要删除可在模板中使用的脚本:
$doc = JFactory::getDocument();
unset($doc->_scripts[$this->baseurl.'/media/system/js/mootools-core.js']);
关于php - 如何删除 joomla 中的所有 javascript?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11517622/