Index: trunk/xpressme_integration_kit/class/config_from_xoops.class.php
===================================================================
--- trunk/xpressme_integration_kit/class/config_from_xoops.class.php	(revision 656)
+++ trunk/xpressme_integration_kit/class/config_from_xoops.class.php	(revision 657)
@@ -20,4 +20,5 @@
 	var $xoops_url;
 	var $xoops_trust_path;
+	var $xoops_cache_path;
 	var $xoops_db_prefix;
 	var $xoops_db_name;
@@ -101,4 +102,5 @@
 			$this->xoops_time_zone = date_default_timezone_get();
 		}
+		$this->_get_cache_path();
     }
 
@@ -253,5 +255,15 @@
 			if(defined('XOOPS_SALT')) $this->xoops_salt = XOOPS_SALT; else $this->xoops_salt = '';
 		} // end of if file_exists
-	}    	
+	}
+	
+	// call after the $this->xoops_trust_path is set
+	function _get_cache_path(){
+		$cache_path = $this->xoops_trust_path . '/cache';
+		if (file_exists($cache_path) && is_writable($cache_path)){
+			$this->xoops_cache_path = $cache_path;
+			return;
+		}
+		$this->xoops_cache_path = $this->xoops_root_path . '/cache';
+	}
     
     function get_xoops_mainfile_path(){
Index: trunk/xpressme_integration_kit/include/xpress_block_render.php
===================================================================
--- trunk/xpressme_integration_kit/include/xpress_block_render.php	(revision 656)
+++ trunk/xpressme_integration_kit/include/xpress_block_render.php	(revision 657)
@@ -122,9 +122,6 @@
     {
     	global $xoops_config;
-    	if(defined('XOOPS_ROOT_PATH')){
-    		$cache_dir = XOOPS_ROOT_PATH . '/cache/';
-    	} else {
-    		$cache_dir = $xoops_config->xoops_root_path . '/cache/';
-    	}
+    	
+		$cache_dir = $xoops_config->xoops_cache_path . '/';
     	$xml_name = $block_name . '.xml';
 
@@ -280,5 +277,5 @@
 		$pattern = '(' . $pattern . ')';
 		
-		$cache_dir = $xoops_config->xoops_root_path . '/cache/';
+		$cache_dir = $xoops_config->xoops_cache_path . '/';
 		$cache_time = 0;
         if ($dh = opendir($cache_dir)) {
Index: trunk/xpressme_integration_kit/include/xpress_cache.php
===================================================================
--- trunk/xpressme_integration_kit/include/xpress_cache.php	(revision 656)
+++ trunk/xpressme_integration_kit/include/xpress_cache.php	(revision 657)
@@ -18,9 +18,6 @@
     {
     	global $xoops_config;
-    	if(defined('XOOPS_ROOT_PATH')){
-    		$cache_dir = XOOPS_ROOT_PATH . '/cache/';
-    	} else {
-    		$cache_dir = $xoops_config->xoops_root_path . '/cache/';
-    	}
+    	
+    	$cache_dir = $xoops_config->xoops_cache_path . '/';
         $filename = $cache_dir .$mydirname . '_' . $collation_key;
         if (xpress_cache_found($filename)) {
@@ -36,5 +33,5 @@
     {
 		global $xoops_config;
-		$cache_dir = $xoops_config->xoops_root_path . '/cache/';
+		$cache_dir = $xoops_config->xoops_cache_path . '/';
 		$cache_time = 0;
 
@@ -53,5 +50,5 @@
     {
 		global $xoops_config;
-		$cache_dir = $xoops_config->xoops_root_path . '/cache/';
+		$cache_dir = $xoops_config->xoops_cache_path . '/';
 		$cache_time = 0;
         if ($dh = opendir($cache_dir)) {
