Keyword

Help resolving js conflict in my header

  • Travis Metcalfe
  • Travis Metcalfe's Avatar Topic Author
  • Offline
  • New Member
More
12 years 9 months ago - 12 years 9 months ago #60272 by Travis Metcalfe
Help resolving js conflict in my header was created by Travis Metcalfe
I have been working at this for awhile and seem to be stuck. I have an error in my header, most likely the result of how I am loading the scripts and was wondering if anyone could point me in the right direction.

Here is my header code:
<?php
defined('_JEXEC') or die('Restricted access'); // no direct access
include_once (dirname(__FILE__).DS.'/functions.php');
$document = isset($this) ? $this : null;
$baseUrl = $this->baseurl;
$templateUrl = $this->baseurl . '/templates/' . $this->template;
artxComponentWrapper($document);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" href="/register?view=login&return=aHR0cHM6Ly93d3cuam9vbWxhd29ya3MubmV0L2ZvcnVtL2syLWVuLzE2OTc2LWhlbHAtcmVzb2x2aW5nLWpzLWNvbmZsaWN0LWluLW15LWhlYWRlcg==" rel="nofollow">Log in  or Create an account to join the conversation.

  • Travis Metcalfe
  • Travis Metcalfe's Avatar Topic Author
  • Offline
  • New Member
More
12 years 9 months ago #60273 by Travis Metcalfe
Replied by Travis Metcalfe on topic Re: Help resolving js conflict in my header
I tried to implement the following section of code from getk2.org/community/New-to-K2-Ask-here-first%21/561-K2-and-mootools#1231 but I still seem to be having a conflict.
<?php 
$document =& JFactory::getDocument(); 
$regexp = '/mootools.js/'; 
foreach ($document->_scripts as $key => $value) { 
if (preg_match($regexp, $key)) 
unset($document->_scripts[$key]); 
} 
?> 
<script type="text/javascript" src="<?php echo JURI::base(); ?>media/system/js/mootools.js"></script> 
<?php 
$regexp = '/jquery/'; 
$jquery = null; 
foreach ($document->_scripts as $key => $value) { 
if (preg_match($regexp, $key)) { 
$jquery[] = $key; 
unset($document->_scripts[$key]); 
} 
} 
foreach ($jquery as $jq_path) { ?> 
<script type="text/javascript" src="<?php echo $jq_path; ?>"></script> 
<?php } ?> 
<script type="text/javascript"> 
if (typeof jQuery !== 'undefined') jQuery.noConflict(); 
</script>

anyone that could share what they have in the head portion of their index.php that I seem to be missing?

Please Log in or Create an account to join the conversation.