Last active
August 29, 2015 14:14
-
-
Save phproberto/1cc224e5d41accfd3b77 to your computer and use it in GitHub Desktop.
Disable scripts inside joomla template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$doc = JFactory::getDocument(); | |
// Supposes you have a template setting with name loadJquery | |
$loadJquery = $this->params->get('loadJquery', 1); | |
if ($loadJquery) | |
{ | |
$removeJs = array( | |
'/jquery.min.js', | |
'/jquery.js', | |
'/jquery-noconflict.js', | |
'/jquery-migrate.min.js', | |
'/jquery-migrate.js', | |
'/bootstrap.min.js', | |
'/bootstrap.js', | |
); | |
$scripts = $doc->_scripts; | |
foreach ($removeJs as $removeScript) | |
{ | |
foreach ($scripts as $script => $scriptdata) | |
{ | |
if (stristr($script, $removeScript)) | |
{ | |
unset($scripts[$script]); | |
} | |
} | |
} | |
$doc->_scripts = $scripts; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment