Welcome Guest, Not a member yet? Register   Sign In
Integrating cloudways CDN to my Codeigniter project

I have set up CDN on Cloudways and was given a CDN Url. This I understand I need to add to my web application built on CodeIgniter.
I tried what solutions I could find on the web but it's either I'm not doing it right or it simply does not work.

I created a new helper file (cdn_helper.php) in my controller folder

PHP Code:
function cdn_base_url($uri)
   $currentInstance =& get_instance();
   $keybasedcdnUrl $currentInstance->config->item('cdn_based_key_url');
   $extensions = array('css''js''jpg''jpeg''png''gif','pdf');
   $pathParts pathinfo($uri);
   if (!empty($keybasedcdnUrl) && in_array($pathParts['extension'],$extensions)) {
       return $keybasedcdnUrl $uri;

   return $currentInstance->config->cdn_base_url($uri);

Then I added this line to my config file

PHP Code:
$config['cdn_based_key_url'] = 'https://457224-1431795-raikfcquaxqncofqfm.stackpathdns.com/'

It didn't work. However, I read something about setting my own prefix to extend the URL helper
PHP Code:
$config['subclass_prefix'] = 'MY_'
when I change the prefix to something like this 'ext.'; it gives an error.
please how do I properly integrate CDN?

Theme © iAndrew 2016 - Forum software by © MyBB