Have a question about CiviCRM? Get it answered quickly at the new CiviCRM Stack Exchange Q+A siteThis forum was archived on 25 November 2017. Learn more.How to get involved.What to do if you think you've found a bug.
{* We need to set jquery $ object back to $*}{* JKM commented out per http://forum.civicrm.org/index.php/topic,8977.0.html<script type="text/javascript">jQuery.noConflict(true);</script>*}</div> {* end crm-container div *}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>"> <head> <title><?php print $head_title ?></title> <?php print $head ?> <?php print $styles ?> <?php print $scripts ?><!-- CiviCRM --><script type="text/javascript" src="/sites/all/modules/civicrm/packages/jquery/jquery-ui.js"></script><style type="text/css">@import url(/sites/all/modules/civicrm/packages/jquery/css/jquery-ui.css);</style><script type="text/javascript" src="/sites/all/modules/civicrm/packages/jquery/plugins/flexigrid.js"></script><style type="text/css">@import url(/sites/all/modules/civicrm/packages/jquery/css/flexigrid.css);</style><script type="text/javascript" src="/sites/all/modules/civicrm/packages/jquery/plugins/jquery.autocomplete.js"></script><style type="text/css">@import url(/sites/all/modules/civicrm/packages/jquery/css/jquery.autocomplete.css);</style><script type="text/javascript" src="/sites/all/modules/civicrm/packages/jquery/plugins/jquery.chainedSelects.js"></script><script type="text/javascript" src="/sites/all/modules/civicrm/packages/jquery/plugins/jquery.treeview.min.js"></script><script type="text/javascript" src="/sites/all/modules/civicrm/packages/jquery/plugins/jquery.bgiframe.pack.js"></script><script type="text/javascript" src="/sites/all/modules/civicrm/packages/tinymce/jscripts/tiny_mce/tiny_mce.js"></script><script type="text/javascript">var cj = $; </script><!-- end CiviCRM -->
if (arg(0) === 'civicrm') { $head .= $template->fetch( 'CRM/common/jquery.tpl' ); }
What about civi testing (in js) if jQuery is already defined, and if the version is higher than what it needs instead of always <script> include it ?I saw an interesting jQuery plugin (that I can't find anymore), that lazy load additional plugins, eg. not always loading the 10 or so plugins, but only when they are needed. Does it ring a bell and have you tried it ?X+
This is probably the best approach: for Civi to wrap its JS deploying code in platform specific implementations. I suspect this is also an issue with Joomla as well, since jQuery is getting a lot of use.It's occurred to me that because jQuery uses the global variable "jquery", that there cannot be a safe way for two instances of jquery to load without the two instances clobbering each other. Aliasing '$' to 'cj' doesn't cut it, because the CiviCRM instance of jquery is still using the jquery variable in background, as is the Drupal instance.Under Drupal, there's no good alternative to using drupal_add_js(). And whatever call Joomla does to accomplish the same thing.