Index: trunk/xpressme_integration_kit/include/xpress_block_render.php
===================================================================
--- trunk/xpressme_integration_kit/include/xpress_block_render.php	(revision 716)
+++ trunk/xpressme_integration_kit/include/xpress_block_render.php	(revision 719)
@@ -68,5 +68,5 @@
 	{
 			$xoopsDB =& Database::getInstance();
-			$modules_tbl = $xoopsDB->prefix('modules');	
+			$modules_tbl = $xoopsDB->prefix('modules');
 
 			$sql = "SELECT mid FROM $modules_tbl WHERE dirname = '$mydirname'";
@@ -87,6 +87,6 @@
 			$wp_prefix = preg_replace('/wordpress/','wp',$mydirname);
 
-			$module_tbl = $xoopsDB->prefix($wp_prefix).'_options';	
-			$theme_name = '';	
+			$module_tbl = $xoopsDB->prefix($wp_prefix).'_options';
+			$theme_name = '';
 
 			$sql = "SELECT option_value FROM $module_tbl WHERE option_name LIKE 'template'";
@@ -139,5 +139,5 @@
 	function xpress_block_render($mydirname,$block_function_name,$options)
 	{
-		global $wpdb,$xoops_config;
+		global $wpdb,$xoops_config,$xoopsUserIsAdmin;
 		$func_file = $block_function_name;
 		$call_theme_function_name = str_replace(".php", "", $block_function_name);
@@ -148,5 +148,6 @@
 		$this_block_url = '/' . $mydirname . '/';
 		$call_url = $_SERVER['REQUEST_URI'];
-		
+		$block['err_message'] = '';
+
 		if (strstr($call_url , $this_block_url) !== false && strstr($call_url , $this_block_url . 'admin/') === false){
 			$block_theme_file = get_block_file_path($mydirname,$inc_theme_file_name);
@@ -154,19 +155,20 @@
 			$block = $call_theme_function_name($options);		//The block name and the called function name should be assumed to be the same name. 
 			if (!empty($block_theme_file['error']))
-				$block['err_message'] = $block_theme_file['error'];
-		} else {
-			global $xoops_config,$xoopsUserIsAdmin;
-			$cache_dir = $xoops_config->xoops_cache_path;
-			if(!is_writable($cache_dir)){
-				$block['err_message'] = _MB_XP2_CACHE_NOT_WRITABLE ;
-				if($xoopsUserIsAdmin)
-					$block['err_message'] .=  " ($cache_dir)";
+				$block['err_message'] .= $block_theme_file['error'];
+		} else {
+			if (xpress_block_cache_found($mydirname,$cache_title. $blockID)){
+				$xml = xpress_block_cache_read($mydirname,$cache_title. $blockID);
+				$block = $xml['block'];
 			} else {
-				if (xpress_block_cache_found($mydirname,$cache_title. $blockID)){
-					$xml = xpress_block_cache_read($mydirname,$cache_title. $blockID);
-					$block = $xml['block'];
-				} else {
-					$block['err_message'] = sprintf(_MB_XP2_BLOCK_CACHE_ERR, '<a href="' . XOOPS_URL . '/modules/' . $mydirname . '">' . $mydirname .'</a>');
-				}
+				$block['err_message'] .= sprintf(_MB_XP2_BLOCK_CACHE_ERR, '<a href="' . XOOPS_URL . '/modules/' . $mydirname . '">' . $mydirname .'</a>');
+			}
+		}
+
+		if(!cache_is_writable()){
+			$block['err_message']  ='<span style="color:#ff0000">';
+			$block['err_message'] .= _MB_XP2_CACHE_NOT_WRITABLE ;
+			if($xoopsUserIsAdmin){
+				$block['err_message'] .=  " ($cache_dir)";
+				$block['err_message'] .= '</span>';
 			}
 		}
@@ -253,16 +255,18 @@
 			if (!empty($block_theme_file['error']))
 				$render_array['block']['err_message'] = $block_theme_file['error'];
-			if (xpress_block_cache_found($mydirname,$cache_title. $blockID)){	
-				$render_serialize = xpress_XML_serialize($render_array);
-				$render_md5 = md5($render_serialize);
-
-				$cache_serialize = xpress_cache_read($mydirname,$cache_title. $blockID.'.xml');
-				$cache_md5 = md5($cache_serialize);
-				
-				if ($render_md5 != $cache_md5){
+			if(cache_is_writable()){
+				if (xpress_block_cache_found($mydirname,$cache_title. $blockID)){	
+					$render_serialize = xpress_XML_serialize($render_array);
+					$render_md5 = md5($render_serialize);
+
+					$cache_serialize = xpress_cache_read($mydirname,$cache_title. $blockID.'.xml');
+					$cache_md5 = md5($cache_serialize);
+					
+					if ($render_md5 != $cache_md5){
+						xpress_block_cache_write($mydirname,$cache_title. $blockID, $render_array);
+					}
+				} else {
 					xpress_block_cache_write($mydirname,$cache_title. $blockID, $render_array);
 				}
-			} else {
-				xpress_block_cache_write($mydirname,$cache_title. $blockID, $render_array);
 			}
 		}
