Skip to content

Instantly share code, notes, and snippets.

@heyjoecampbell
Last active November 7, 2016 23:26
Show Gist options
  • Save heyjoecampbell/ecd68c7447fa8c55a82ac8bfc83cdb93 to your computer and use it in GitHub Desktop.
Save heyjoecampbell/ecd68c7447fa8c55a82ac8bfc83cdb93 to your computer and use it in GitHub Desktop.
Unset Joomla! Scripts from Template
// Unset unwanted Scripts - by name
$unset_script = array('k2');
foreach($this->_scripts as $name=>$script)
{
foreach($unset_script as $script)
{
if (strpos($name,$script) !== false)
{
unset($this->_scripts[$name]);
}
}
}
@regularlabs
Copy link

Try this. Bit cleaner.

// Unset unwanted Scripts - by name
$unset_scripts = array(
	'k2',
	'...',
);

foreach($this->_scripts as $name=>$script)
{
	if (!preg_match('#(' . implode('|', $unset_scripts) . '#i', $name))
	{
		continue;
	}

	unset($this->_scripts[$name]);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment