- Timestamp:
- Dec 21, 2008, 3:01:51 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/blocks/xpress_block_recent_comments.php
r35 r36 66 66 $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname; 67 67 68 69 68 $myts =& MyTextSanitizer::getInstance(); 70 69 … … 96 95 97 96 global $wpdb; 98 $block = array(99 'mydirname' => $mydirname ,100 'mod_url' => XOOPS_URL.'/modules/'.$mydirname ,101 ) ;102 97 103 98 if (!is_null($wpdb)){ 99 $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 "; 100 $comment_sql .= "FROM $wpdb->comments LEFT JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID "; 101 $comment_sql .= "WHERE comment_approved = '1' AND post_type = 'post' AND post_status = 'publish' $type_select "; 102 $comment_sql .= "ORDER BY comment_date_gmt DESC LIMIT $disp_count"; 104 103 105 $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");104 $comments = $wpdb->get_results($comment_sql); 106 105 $format = get_settings('date_format') . ' ' . get_settings('time_format'); 107 106 108 107 if ( $comments ) { 109 108 $output .= '<ul>'; 109 $item_no = 0; 110 110 foreach ($comments as $comment){ 111 111 $comment_content = $comment->comment_content; … … 114 114 $comment_link = get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID ; 115 115 $comment_title = $comment_excerpt; 116 $comment_title_link = "<a href='$comment_link' rel='external nofollow' class='url'>$comment_t ytle</a>";116 $comment_title_link = "<a href='$comment_link' rel='external nofollow' class='url'>$comment_title</a>"; 117 117 118 118 $post_link = get_comment_link($comment->comment_ID); … … 130 130 'comment_ID' => $comment->comment_ID , 131 131 'comment_post_ID' => $comment->comment_post_ID , 132 'comment_date' => $comment->comment_date , 132 'comment_date' => date(get_settings('date_format'),$comment->comment_unix_time) , 133 'comment_date_time' => date(get_settings('date_format') . ' ' . get_settings('time_format'),$comment->comment_unix_time) , 133 134 'comment_content' => $comment_content , 134 135 'comment_excerpt' => $comment_excerpt , 135 136 'comment_link' => $comment_link, 136 'comment_title' => $c comment_title ,137 'comment_title' => $comment_title , 137 138 'comment_title_link' => $comment_title_link , 138 139 'post_link' => $post_link, … … 146 147 ); 147 148 148 $block['contents'][] = $row_data; 149 $block['contents']['item'.$item_no] = $row_data; 150 $item_no++; 149 151 } 150 152 } 153 require_once dirname(dirname( __FILE__ )).'/include/xoops_block_cache.php'; 154 xpress_block_cache_write($mydirname,'recent_comment_block',$block); 151 155 } else { 152 // $block['contents'] = "out of module"; 156 require_once dirname(dirname( __FILE__ )).'/include/xoops_block_cache.php'; 157 $block = xpress_block_cache_read($mydirname,'recent_comment_block'); 153 158 } 154 return $block ; 155 159 return $block ; 156 160 } 157 161 } -
trunk/templates/blocks/xpress_block_recent_comments.html
r35 r36 2 2 <{foreach from=$block.contents item=content}> 3 3 <li> 4 <{$content.from_auther_to_post}><br /> <br />4 <{$content.from_auther_to_post}><br /> 5 5 <{$content.comment_ID}><br /> 6 6 <{$content.comment_post_ID}><br /> 7 7 <{$content.comment_date}><br /> 8 <{$content.comment_date_time}><br /> 8 9 <{$content.comment_content}><br /> 9 10 <{$content.comment_excerpt}><br /> … … 17 18 <{$content.author_name}><br /> 18 19 <{$content.author_name_link}><br /> 19 <{$content.comment_type}><br /> 20 <{$content.comment_type}><br /><br /> 20 21 </li> 21 22 <{/foreach}>
Note: See TracChangeset
for help on using the changeset viewer.