我在这里使用代码
<head>
...
<?php
$user =& JFactory::getUser();
if ($user->get('guest') == 1) {
$headerstuff = $this->getHeadData();
$headerstuff['scripts'] = array(); $this->setHeadData($headerstuff);
}
?>
<jdoc:include type="head" />
</head>
Run Code Online (Sandbox Code Playgroud)
但是当运行代码是模板加载所有javascript时,如何修复它删除模板joomla中的标头中的所有javasccript
要删除可在模板中使用的脚本:
$doc = JFactory::getDocument();
unset($doc->_scripts[$this->baseurl.'/media/system/js/mootools-core.js']);
Run Code Online (Sandbox Code Playgroud)