The cegcore asset libraries are all loading using an absolute url rather than a relative url. This is causing some issues on a site I have running on a private intranet. Example:
<link href="http://localhost:8080/bmt/libraries/cegcore/assets/bootstrap/css/bootstrap.css" media="screen" rel="stylesheet" type="text/css" />
<link href="http://localhost:8080/bmt/libraries/cegcore/assets/bootstrap/css/bootstrap-theme.css" media="screen" rel="stylesheet" type="text/css" />
<link href="http://localhost:8080/bmt/libraries/cegcore/assets/bootstrap/css/bootstrap-gcore.css" media="screen" rel="stylesheet" type="text/css" />
etc..
Is there anyway to get the assets to load with just the relative url? The core Joomla libraries all load relative:
<script src="/bmt/media/jui/js/jquery.min.js" type="text/javascript"></script>
<script src="/bmt/media/jui/js/jquery-noconflict.js" type="text/javascript"></script>
<script src="/bmt/media/jui/js/jquery-migrate.min.js" type="text/javascript"></script>
etc...
<link href="http://localhost:8080/bmt/libraries/cegcore/assets/bootstrap/css/bootstrap.css" media="screen" rel="stylesheet" type="text/css" />
<link href="http://localhost:8080/bmt/libraries/cegcore/assets/bootstrap/css/bootstrap-theme.css" media="screen" rel="stylesheet" type="text/css" />
<link href="http://localhost:8080/bmt/libraries/cegcore/assets/bootstrap/css/bootstrap-gcore.css" media="screen" rel="stylesheet" type="text/css" />
etc..
Is there anyway to get the assets to load with just the relative url? The core Joomla libraries all load relative:
<script src="/bmt/media/jui/js/jquery.min.js" type="text/javascript"></script>
<script src="/bmt/media/jui/js/jquery-noconflict.js" type="text/javascript"></script>
<script src="/bmt/media/jui/js/jquery-migrate.min.js" type="text/javascript"></script>
etc...
Hi bmurphey,
I think that the files are all loaded from /libraries/cegcore/libs/document.php - you could try editing that and replace \GCore\C::get('GCORE_FRONT_URL') with '/bmt/libraries/cegcore/' so, for example line 114 changes from
Bob
I think that the files are all loaded from /libraries/cegcore/libs/document.php - you could try editing that and replace \GCore\C::get('GCORE_FRONT_URL') with '/bmt/libraries/cegcore/' so, for example line 114 changes from
$this->addJsFile(\GCore\C::get('GCORE_FRONT_URL').'assets/jquery/jquery.js');to$this->addJsFile('/bmt/libraries/cegcore/'.'assets/jquery/jquery.js');
Bob
Thanks Bob.
I tried that but doesn't seem to be changing anything. I will keep investigating. Please let me know if you have any other ideas.
Thanks!
Brian
I tried that but doesn't seem to be changing anything. I will keep investigating. Please let me know if you have any other ideas.
Thanks!
Brian
I take that back: It did change the path. The path is now:
<script src="http://localhost:8080/bmt/libraries/cegcore//bmt/libraries/cegcore/assets/jquery/jquery.js" type="text/javascript"></script>
So apparently the absolute is getting tacked on somewhere else.
Thanks -
-Brian
<script src="http://localhost:8080/bmt/libraries/cegcore//bmt/libraries/cegcore/assets/jquery/jquery.js" type="text/javascript"></script>
So apparently the absolute is getting tacked on somewhere else.
Thanks -
-Brian
Hi Brian,
Is there a $livesite setting in the site Configuration.php file - that can cause the domain part to be added?
Bob
Is there a $livesite setting in the site Configuration.php file - that can cause the domain part to be added?
Bob
Hi Brian,
Another possibility to try, At line 80 of /libraries/cegcore/libs/document.php is this function
There's a similar CSS function just before that.
Bob
Another possibility to try, At line 80 of /libraries/cegcore/libs/document.php is this function
function addJsFile($path, $type = 'text/javascript'){
if(substr($path, 0, 4) != 'http'){
if(strpos($path, '/') === false){
$path = \GCore\Helpers\Assets::js($path);
}else{
//relative file path provided
$path = $this->url.$path; // << try commenting out this line
}
}
if(!in_array($path, (array)Arr::getVal($this->jsfiles, array('[n]', 'src')))){
$this->jsfiles[] = array('src' => $path, 'type' => $type);
}
}You can try commenting out the line I've flagged which appears to be converting the URLs from Relative to Absolute.
There's a similar CSS function just before that.
Bob
This topic is locked and no more replies can be posted.
