Javascript.php library broken |
[eluser]Unknown[/eluser]
After hours of fiddling with the javascript library and trying to follow the multitude of examples on the web, I finally looked into the source and must say that it makes no sense The standard external method always generates a bogus script URL because it simply duplicates the argument passed in. By setting $this->_javascript_location to the $external_file argument and then returning $this->_javascript_location.$external_file one always ends up with something like http://localhost/js/jquery.jsjquery.js for example Or am I completely misunderstanding this? Can someone explain how this is supposed to work? All I want to do is to add additional javascript libraries I have in a special directory I have specified in config <code> function external($external_file = '', $relative = FALSE) { if ($external_file !== '') { $this->_javascript_location = $external_file; } else { if ($this->CI->config->item('javascript_location') != '') { $this->_javascript_location = $this->CI->config->item('javascript_location'); } } if ($relative === TRUE OR strncmp($external_file, 'http://', 7) == 0 OR strncmp($external_file, 'https://', 8) == 0) { $str = $this->_open_script($external_file); } elseif (strpos($this->_javascript_location, 'http://') !== FALSE) { $str = $this->_open_script($this->_javascript_location.$external_file); } else { $str = $this->_open_script($this->CI->config->slash_item('base_url').$this->_javascript_location.$external_file); } $str .= $this->_close_script(); return $str; } </code> |
Welcome Guest, Not a member yet? Register Sign In |