Hi,
When CDN is enabled,
and you load a script through
the smarty {script src=""} syntax,
it does not use the CDN url.
The CDN is used only for the scripts.js file,
which you can extend using hooks/index/scripts.post.tpl .
But, If you want to load a js file in another tpl,
(for example a big js that is only needed in some pages),
the CDN url is not used.
Is there a fix for that?
Thanks.
You should be able to use the {script} tag in that other addon.
Hi,
I think I didn't make it clear.
When I include scripts using the {script} syntax, the cdn url is not used.
That's what I m looking a solution for.
Thanks
Hi,
I think I didn't make it clear.
When I include scripts using the {script} syntax, the cdn url is not used.
That's what I m looking a solution for.
Thanks
Make sure to do
{scripts}
{script src="..."}
{/scripts}
Hi,
Thanks for your response!
Unfortunately it throws errors like...
"Tygh is not defined" and
"$ is not defined"
Very strange
Seems they forgot about that
Managed to do it this way:
/**
* Create a script url that uses CDN.
*
* @param string $src
* @return string
*/
function fn_my_changes_script_url($src){
$url = \Tygh\Storage::instance('assets')->getUrl($src);
//remove assets part
$url = str_replace('/var/cache/misc/assets', '', $url);
return $url;
}
Called using: