Index: trunk/blocks/xpress_block_recent_comments.php
===================================================================
--- trunk/blocks/xpress_block_recent_comments.php	(revision 35)
+++ trunk/blocks/xpress_block_recent_comments.php	(revision 36)
@@ -66,5 +66,4 @@
 		$mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
 		
-
 		$myts =& MyTextSanitizer::getInstance();
 
@@ -96,16 +95,17 @@
 		
 		global $wpdb;
-		$block = array( 
-		'mydirname' => $mydirname ,
-		'mod_url' => XOOPS_URL.'/modules/'.$mydirname ,
-		) ;
 			
 		if (!is_null($wpdb)){
+			$comment_sql  = "SELECT comment_ID,comment_post_ID,comment_author,comment_author_email,comment_author_url,comment_content, comment_type,UNIX_TIMESTAMP(comment_date) as comment_unix_time ";
+			$comment_sql .= "FROM $wpdb->comments LEFT JOIN $wpdb->posts ON  $wpdb->posts.ID = $wpdb->comments.comment_post_ID ";
+			$comment_sql .= "WHERE comment_approved = '1' AND post_type = 'post'  AND post_status = 'publish' $type_select ";
+			$comment_sql .= "ORDER BY comment_date_gmt DESC LIMIT $disp_count";
 
-			$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments LEFT JOIN $wpdb->posts ON  $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_type = 'post'  AND post_status = 'publish' $type_select ORDER BY comment_date_gmt DESC LIMIT $disp_count");
+			$comments = $wpdb->get_results($comment_sql);
 			$format = get_settings('date_format') . ' ' . get_settings('time_format');				
 
 			if ( $comments ) {
 				$output .= '<ul>';
+				$item_no = 0;
 				foreach ($comments as $comment){
 					$comment_content = $comment->comment_content;
@@ -114,5 +114,5 @@
 					$comment_link = get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID ;
 					$comment_title = $comment_excerpt;
-					$comment_title_link = "<a href='$comment_link' rel='external nofollow' class='url'>$comment_tytle</a>";
+					$comment_title_link = "<a href='$comment_link' rel='external nofollow' class='url'>$comment_title</a>";
 
 					$post_link = get_comment_link($comment->comment_ID);
@@ -130,9 +130,10 @@
 						'comment_ID' 		=> $comment->comment_ID ,
 						'comment_post_ID'	=> $comment->comment_post_ID ,
-						'comment_date' 		=> $comment->comment_date ,
+						'comment_date' 		=> date(get_settings('date_format'),$comment->comment_unix_time) ,
+						'comment_date_time' => date(get_settings('date_format') . ' ' . get_settings('time_format'),$comment->comment_unix_time) ,
 						'comment_content' 	=> $comment_content ,
 						'comment_excerpt' 	=> $comment_excerpt ,	
 						'comment_link' 		=> $comment_link,
-						'comment_title' 	=> $ccomment_title ,
+						'comment_title' 	=> $comment_title ,
 						'comment_title_link' => $comment_title_link ,
 						'post_link' 		=> $post_link,
@@ -146,12 +147,15 @@
 					);
 					
-					$block['contents'][] = $row_data;
+					$block['contents']['item'.$item_no] = $row_data;
+					$item_no++;
 				}
 			}
+			require_once dirname(dirname( __FILE__ )).'/include/xoops_block_cache.php';
+			xpress_block_cache_write($mydirname,'recent_comment_block',$block);
 		} else {
-//			$block['contents'] = "out of  module";
+			require_once dirname(dirname( __FILE__ )).'/include/xoops_block_cache.php';
+			$block = xpress_block_cache_read($mydirname,'recent_comment_block');
 		}
-			return $block ;
-
+		return $block ;
 	}
 }
Index: trunk/include/xoops_block_cache.php
===================================================================
--- trunk/include/xoops_block_cache.php	(revision 36)
+++ trunk/include/xoops_block_cache.php	(revision 36)
@@ -0,0 +1,17 @@
+<?php
+	require_once dirname( __FILE__ ) .'/xml.php' ;
+	require_once dirname( __FILE__ ) .'/xpress_cache.php' ;
+	
+	function xpress_block_cache_write($mydirname,$block_name,$block)
+	{
+			$xml = XML_serialize($block);
+			$xml_name = $block_name . '.xml';
+			xpress_cache_write($mydirname,$xml_name,$xml);
+	}
+	function xpress_block_cache_read($mydirname,$block_name)
+	{
+			$xml_name = $block_name . '.xml';
+			$xml_data = xpress_cache_read($mydirname,$xml_name);
+			return @XML_unserialize($xml_data);
+	}
+?>
Index: trunk/include/xpress_cache.php
===================================================================
--- trunk/include/xpress_cache.php	(revision 36)
+++ trunk/include/xpress_cache.php	(revision 36)
@@ -0,0 +1,50 @@
+<?php
+	
+if(!function_exists("xpress_cache_read")):
+    function xpress_cache_read($mydirname,$collation_key)
+    {
+		$cache_dir = XOOPS_ROOT_PATH . '/cache/';
+		$cache_time = 0;
+        $filename = $cache_dir .$mydirname . '_' . $collation_key;
+//        if (file_exists($filename) && ((time() - filemtime($filename)) < $cache_time)) {
+        if (file_exists($filename)) {
+            return file_get_contents($filename);
+       } else {
+			return '';
+		}
+    } 
+endif;
+
+if(!function_exists("xpress_cache_write")):
+    function xpress_cache_write($mydirname,$collation_key,$content)
+    {
+		$cache_dir = XOOPS_ROOT_PATH . '/cache/';
+		$cache_time = 0;
+
+        $filename = $cache_dir .$mydirname . '_' . $collation_key;
+//        if ((time() - @filemtime($filename)) > $cache_time) {
+            $fp = fopen($filename, "w");
+            flock($fp, 2);
+            fputs($fp, $content);
+            fclose($fp);
+ //       } 
+    } 
+endif;
+
+if(!function_exists("xpress_block_cache_clear")):
+    function xpress_cache_clear($mydirname)
+    {
+		$cache_dir = XOOPS_ROOT_PATH . '/cache/';
+		$cache_time = 0;
+        if ($dh = opendir($cache_dir)) {
+            while (($file = readdir($dh)) !== false) {
+                if (preg_match('/^' . preg_quote($mydirname) . '/', $file)) {
+                    unlink($cache_dir.$file);
+                } 
+            } 
+            closedir($dh);
+        } 
+    } 
+endif;
+
+?>
Index: trunk/templates/blocks/xpress_block_recent_comments.html
===================================================================
--- trunk/templates/blocks/xpress_block_recent_comments.html	(revision 35)
+++ trunk/templates/blocks/xpress_block_recent_comments.html	(revision 36)
@@ -2,8 +2,9 @@
 	<{foreach from=$block.contents item=content}>
 		<li>
-				<{$content.from_auther_to_post}><br /><br />
+				<{$content.from_auther_to_post}><br />
 				<{$content.comment_ID}><br />
 				<{$content.comment_post_ID}><br />
 				<{$content.comment_date}><br />
+				<{$content.comment_date_time}><br />
 				<{$content.comment_content}><br />
 				<{$content.comment_excerpt}><br />
@@ -17,5 +18,5 @@
 				<{$content.author_name}><br />
 				<{$content.author_name_link}><br />
-				<{$content.comment_type}><br />
+				<{$content.comment_type}><br /><br />
 		</li>
 	<{/foreach}>
