Index: trunk/include/xpress_block_render.php
===================================================================
--- trunk/include/xpress_block_render.php	(revision 95)
+++ trunk/include/xpress_block_render.php	(revision 96)
@@ -99,4 +99,24 @@
 	}
 	
+    function xpress_block_cache_found($mydirname,$block_name)
+    {
+    	global $xoops_config;
+    	if(defined('XOOPS_ROOT_PATH')){
+    		$cache_dir = XOOPS_ROOT_PATH . '/cache/';
+    	} else {
+    		$cache_dir = $xoops_config->xoops_root_path . '/cache/';
+    	}
+    	$xml_name = $block_name . '.xml';
+
+        $filename = $cache_dir .$mydirname . '_' . $xml_name;
+		$cache_time = 0;
+//        if (file_exists($filename) && ((time() - filemtime($filename)) < $cache_time)) {
+        if (file_exists($filename)) {
+            return true;
+       } else {
+			return false;
+		}
+    } 
+	
 	function xpress_block_render($mydirname,$block_function_name,$options)
 	{
@@ -108,5 +128,7 @@
 		$blockID =get_block_id($mydirname,$func_file,$options);		
 
-		if (!is_null($wpdb)){
+		$this_url = '/modules/'. $mydirname;
+		$call_url = $_SERVER['REQUEST_URI'];
+		if (strstr($call_url,$this_url)){
 			xpress_block_css_set($mydirname);
 			
@@ -114,10 +136,11 @@
 			require_once $block_theme_file;
 			$block = $call_theme_function_name($options);		//The block name and the called function name should be assumed to be the same name. 
-
-// Not Cache Write Now.  Becose Cache Write On WordPress Event			
-//			xpress_block_cache_write($mydirname,$cache_title. $blockID, $block);  
 		} else {
-			$xml = xpress_block_cache_read($mydirname,$cache_title. $blockID);
-			$block = $xml['block'];
+			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_XPRESS_BLOCK_CACHE_ERR, '<a href="' . XOOPS_URL . '/modules/' . $mydirname . '">' . $mydirname .'</a>');
+			}
 		}
 
