Knowledgebase: Step by Step Guides
Use a Content Delivery Network (CDN)
Posted by - NA -, Last modified by AJ Hall on 27 May 2019 11:28 PM

Use a Content Delivery Network (CDN)

Note - This is not part of our standard installation. We DO NOT provide CDN related support as CDN is a 3rd party service not provided by Elevated X. Use of a CDN may affect CMS functionality.

More details on the different options for CDNs are listed below:

 

PHP Templates - Unprotected CDN and Mirrored URL:

1) Within the admin panel, click the Sprocket in the top right of the screen. Go to Manage Site Areas.

2) Choose the area within the list that applies to the directory and template folder that your members area / tour area is using. Click Edit

3) Under "Content Directory", you'll see an entry that denotes a path to your content directory:

e.g: /members/content/

You'll want to change this to the path of your CDN:

e.g: http://pathtocdn.com/folder/

Note: The folder on the CDN's side MUST correspond to the content folder on your server.

4) After this is done, scroll to the bottom of the page and click "Edit Entry"

 

PHP Templates - Protected CDN or Non-mirrored URL:

Often, CDN providers have a content protection mechanism in place that prevents people without authorization from leeching your content.

This may include a token or dynamically written URL.

The way CDN providers protect their content is different from CDN provider to CDN provider.

The Elevated X CMS provides an easy way for the CDN provider or third party developer to integrate with the CDN.

1) Within your PHP template file, there should be file / folder called:

/cms_admin/phptemplate/[PHP_TEMPLATE_FOLDER]/functions/cdn_hook.tpl

2) In this file, you'll see:

<?php

// function cdn_hook()
// Input: A string that denotes the filename.
// Returns: A new path to a filename that works with a CDN.

function cdn_hook($file)
{
    // By default, this file does nothing to the file paths, so it returns what it received.
    // Comment this out if you are looking to integrate a CDN:
    
    return $file;
    
    // Custom CDN code goes here
}

Within our default templates, all images and movie paths pass through this function. By default, the function returns the file value that is passed to it.

Your CDN provider or third party coder can make changes to this function and rewrite the paths to the CDN URL path.

 

Smarty Templates - Unprotected CDN and Mirrored URL:

Within your smarty template folder is a subfolder called config.  In there are two files:
static.conf
static.trial.conf

Within each of these files is a setting called contentdir:

contentdir= /members/content

You will want to change this to the path to your CDN:

contentdir=http://pathtocdn.com/folder/

Note: The folder on the CDN's side MUST correspond to the content folder on your server.

 

Smarty Templates - Protected CDN or Nonmirrored URL:

If your CDN requires that your content URL requires a token or a URL change, then you will need to integrate custom code into the CMS. 

Please see the article Integrating Custom PHP Code to see how to do this:

https://support.elevatedx.com/index.php?/Knowledgebase/Article/View/85/3/integrate-custom-php-code

 

MediaElements.js / JW Player Notes:

Note: If the CDN is using a different domain, the cross domain file settings for the player may need to be changed. A guide to do this is available here:

Media Elements:
http://mediaelementjs.com/support/

JW Player:
http://support.jwplayer.com/customer/portal/articles/1403679-crossdomain-file-loading

 

(0 vote(s))
Helpful
Not helpful

Comments (0)