Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

MAX cdn

 
Reply
   X-Cart forums > X-Cart 4 > Third Party Add-Ons for X-Cart 4
 
Thread Tools
  #11  
Old 09-21-2012, 01:30 AM
 
philrisk philrisk is offline
 

X-Adept
  
Join Date: Jul 2009
Location: Newcastle upon Tyne, UK
Posts: 412
 

Default Re: MAX cdn

Quote:
Originally Posted by PhilJ
Might help...

PHP Code:
/**
 * Store all compiled templates to the single directory
 */
$smarty->use_sub_dirs false;

if (! empty ( 
$alt_skin_dir )) {
    
    
$smarty->template_dir = array ($alt_skin_dir$xcart_dir $smarty_skin_dir );
    
    
$compileDir $var_dirs ['templates_c'] . XC_DS md5 $alt_skin_dir );
    
    if (! 
is_dir $compileDir )) {
        
        
func_mkdir $compileDir );
    
    }
    
    
$smarty->compile_dir $compileDir;
    
    if (@
file_exists $alt_skin_dir XC_DS 'css' XC_DS 'altskin.css' )) {

/* CDN support for smarty BEGIN */
        
define "CDN_SUPPORT"true );
        
        if (! 
CDN_SUPPORT) {
            
$cdn_web_dir $xcart_web_dir;
        } else {
            if (
$HTTPS) {
                
$__CDN_BASE_URL 'https://www.yourstore.com';
            } else {
                
$__CDN_BASE_URL 'http://yourstore.yourstore.netdna-cdn.com';
            }
            
            
$smarty->assign 'AltImagesDir'$__CDN_BASE_URL $alt_skin_info ['alt_skin_dir'] . '/images' );
            
$smarty->assign 'AltSkinDir'$__CDN_BASE_URL $alt_skin_info ['alt_skin_dir'] );
            
            
$cdn_web_dir $__CDN_BASE_URL;
        }
        
    
//  $smarty->assign('AltImagesDir', $alt_skin_info['web_path'] . '/images');
    //  $smarty->assign('AltSkinDir',   $alt_skin_info['web_path']);;        

/* CDN support for smarty END */
    
}

} else {
    
    
$smarty->template_dir $xcart_dir $smarty_skin_dir;
    
$smarty->compile_dir $var_dirs ['templates_c'];



Is that for the AltImages?
__________________
Live with Gold 4.5.1
Dedicated Linux server
MaxCDN 4 pull zones
Dedicated SSL

Reply With Quote
  #12  
Old 09-21-2012, 01:31 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,071
 

Default Re: MAX cdn

Give it a bash, works for a client of mine...
__________________
xcartmods.co.uk
Reply With Quote
  #13  
Old 09-21-2012, 01:39 AM
 
philrisk philrisk is offline
 

X-Adept
  
Join Date: Jul 2009
Location: Newcastle upon Tyne, UK
Posts: 412
 

Default Re: MAX cdn

Quote:
Originally Posted by PhilJ
Give it a bash, works for a client of mine...
I already have AltImages working via my mod above. I am looking to do product T and P images. Any ideas?
__________________
Live with Gold 4.5.1
Dedicated Linux server
MaxCDN 4 pull zones
Dedicated SSL

Reply With Quote
  #14  
Old 09-21-2012, 01:42 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,071
 

Default Re: MAX cdn

That should work for T and P images, yes.
__________________
xcartmods.co.uk
Reply With Quote
  #15  
Old 09-21-2012, 01:46 AM
 
JacksmithxD JacksmithxD is offline
 

X-Adept
  
Join Date: Oct 2010
Posts: 400
 

Talking Re: MAX cdn

I can verify that the code Phil has provided works, MaxCDN installed correctly is awesome.
__________________
Xcart 4.5.2
Reply With Quote
  #16  
Old 09-21-2012, 01:56 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,071
 

Default Re: MAX cdn

Quote:
I can verify that the code Phil has provided works, MaxCDN installed correctly is awesome.

^ what he said
__________________
xcartmods.co.uk
Reply With Quote
  #17  
Old 09-21-2012, 02:05 AM
 
philrisk philrisk is offline
 

X-Adept
  
Join Date: Jul 2009
Location: Newcastle upon Tyne, UK
Posts: 412
 

Default Re: MAX cdn

Quote:
Originally Posted by PhilJ
That should work for T and P images, yes.

Hi PhilJ

That doesn't seem to work for T and P images. Works fine for AltImages though.
__________________
Live with Gold 4.5.1
Dedicated Linux server
MaxCDN 4 pull zones
Dedicated SSL

Reply With Quote
  #18  
Old 09-21-2012, 02:23 AM
 
philrisk philrisk is offline
 

X-Adept
  
Join Date: Jul 2009
Location: Newcastle upon Tyne, UK
Posts: 412
 

Default Re: MAX cdn

PHP Code:
// WCM - CDN Images 
        
if (($type == 'T' OR $type == 'P') AND $_SERVER['HTTPS'] != 'on'
        { 
        
$image_path str_replace('/path/to/images/','http://collectables.collectablesreta.netdna-cdn.com/',$image_path); 
        return 
str_replace('$http_location','',$image_path); 
        } 
        
// / WCM - CDN Images 

This changes the url correctly but the images are missing and not being pulled by maxcdn.
__________________
Live with Gold 4.5.1
Dedicated Linux server
MaxCDN 4 pull zones
Dedicated SSL

Reply With Quote
  #19  
Old 09-21-2012, 02:31 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,071
 

Default Re: MAX cdn

Skip to...

http://forum.x-cart.com/showpost.php?p=352228&postcount=57
__________________
xcartmods.co.uk
Reply With Quote
  #20  
Old 09-21-2012, 03:00 AM
 
philrisk philrisk is offline
 

X-Adept
  
Join Date: Jul 2009
Location: Newcastle upon Tyne, UK
Posts: 412
 

Default Re: MAX cdn

Sorry this did work just needed my image path tweaked. Well worked for thumbnails anyway not P images.
__________________
Live with Gold 4.5.1
Dedicated Linux server
MaxCDN 4 pull zones
Dedicated SSL

Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Third Party Add-Ons for X-Cart 4


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:00 AM.

   

 
X-Cart forums © 2001-2020