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 ;
 	}
 }
