开发者

jQuery instead of Mootools in Joomla 1.6

开发者 https://www.devze.com 2023-03-12 20:31 出处:网络
Am am using both jQuery and Mootools on my Joomla frontend. Is there eny simple way to 开发者_Go百科get rid of Mootools without editing Joomla core files, this is what i\'ve been doing but I dont want

Am am using both jQuery and Mootools on my Joomla frontend. Is there eny simple way to 开发者_Go百科get rid of Mootools without editing Joomla core files, this is what i've been doing but I dont want that temprorary solution any more.


In template's index.php:

$user     =& JFactory::getUser();
$app      =& JFactory::getApplication();

// Keep MooTools on the back-end 
if ( $app->isSite() ) {

  $prohibited = array (
        '/media/system/js/core.js',
        '/media/system/js/mootools-core.js',
        '/media/system/js/mootools-more.js',
        '/media/system/js/caption.js'
        );

 foreach ($this->_scripts as $key => $value) {
  if( in_array($key, $prohibited ) ) {
        unset($this->_scripts[$key]);
  }
 }
}

There are plugins, but despite the fact you will install another 3rd party plugin, you should know that if some Mootools script is added to Joomla in the future you will have to wait for the plugin to be updated. With this code you have better control, because all what you need to do is add the URI of the new script to the '$prohibited' array.


There are a couple of ways of doing this.

  1. There is a plugin, which I found here
  2. You can edit the core files, which you said you do not want to do. (I found a guide on how to do it here)

But why not use MooTools? It has almost all the plugins you could find with jQuery, and the code it about the same (not to mention it is more powerful)

0

精彩评论

暂无评论...
验证码 换一张
取 消