Advanced search  


CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Javascript Files - HTTP_PULL CDN  (Read 2096 times)

0 Members and 1 Guest are viewing this topic.


  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Javascript Files - HTTP_PULL CDN
« on: November 16, 2013, 11:53:33 am »

Let me preface this with I hate asking questions and normally prefer to figure out things on my own... But hours of searching haven't helped. :(

I use a CDN for my website with US/EU nodes to reduce some of the load on the server. One of the things it does is use HTTP_PULL to cache the Javascript files. Since Javascript on CPG is loaded using the {JAVASCRIPT} token... this makes it harder to modify the code to use the CDN and no the local copies. That being said I've resorted to editing to do this. I don't really like doing such as I'm editing core files and that's rarely a good idea...

Is there a way to modify the theme files (theme.php) and change the Javascript Token to do the same thing I've done with the file... Or am I just stuck editing the functions file?

I'm using version 1.5.20

Code: [Select]
function js_include($filename, $inline = false)
    global $JS;

    // Proceed with inclusion only if the file exists
    if (!file_exists($filename)) {

    // If we need to show the html inline then return the required html
    if ($inline) {
        return '<script type="text/javascript" src="[domain-goes-here]' . $filename . '"></script>';
    } else {
        // Else add the file to js includes array which will later be used in head section
        $JS['includes'][] = $filename;
} // function js_include


  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Javascript Files - HTTP_PULL CDN
« Reply #1 on: November 21, 2013, 01:39:15 pm »

You can always use the plugin hook page_html to modify HTML output before it will be sent to the browser.
Pages: [1]   Go Up

Page created in 0.019 seconds with 20 queries.