リビジョン | 249 (tree) |
---|---|
日時 | 2010-08-23 11:12:53 |
作者 | kmorimatsu |
'aname','alink','comments' data by <%blog%> tag.
@@ -105,9 +105,15 @@ | ||
105 | 105 | i.keywords as keywords, |
106 | 106 | i.xml as xml, |
107 | 107 | "item" as xtable, |
108 | + m.name as aname, | |
108 | 109 | c.name as cname, |
109 | - c.desc as cdesc | |
110 | - FROM jeans_item as i, jeans_group as c '.$where; | |
110 | + c.desc as cdesc, | |
111 | + count(o.id) as comments | |
112 | + FROM jeans_item as i, jeans_group as c, jeans_member as m | |
113 | + LEFT JOIN jeans_comment as o ON o.itemid=i.id | |
114 | + WHERE i.sgid=c.id | |
115 | + AND i.author=m.id | |
116 | + AND '.$where; | |
111 | 117 | } |
112 | 118 | static private $narrowby=array('category'=>false,'archive'=>false,'search'=>false,'showhidden'=>false); |
113 | 119 | static public function tag_narrowby() { |
@@ -149,8 +155,7 @@ | ||
149 | 155 | $hide=!$narrowby['showhidden']; |
150 | 156 | // Prepare query and array-data |
151 | 157 | $query=self::query_select( |
152 | - 'WHERE i.gid=<%blogid%> | |
153 | - AND i.sgid=c.id | |
158 | + 'i.gid=<%blogid%> | |
154 | 159 | AND i.time <= <%now%> '. |
155 | 160 | ($subgroup ? 'AND i.sgid IN (<%subgroups%>) ':''). |
156 | 161 | ($archivestart ? 'AND <%archivestart%> <= i.time ':''). |
@@ -157,7 +162,8 @@ | ||
157 | 162 | ($archiveend ? 'AND i.time < <%archiveend%> ':''). |
158 | 163 | ($search ? 'AND libs_blog_search(i.title,i.body,i.more,i.keywords) ':''). |
159 | 164 | ($hide ? 'AND NOT (i.flags & <%const:sql::FLAG_HIDDEN%>) AND NOT (c.flags & <%const:sql::FLAG_HIDDEN%>) ':''). |
160 | - 'ORDER by time DESC | |
165 | + 'GROUP BY i.id | |
166 | + ORDER BY time DESC | |
161 | 167 | LIMIT <%limit%> OFFSET <%offset%>'); |
162 | 168 | $array=array( |
163 | 169 | 'blogid'=>$blogid, |
@@ -177,6 +183,7 @@ | ||
177 | 183 | if (self::category('id')) $item_array=array_merge($item_array,$cat_array); |
178 | 184 | $row['link']=view::create_link($item_array); |
179 | 185 | $row['clink']=view::create_link($cat_array); |
186 | + $row['alink']=view::create_link(array('memberid'=>(int)$row['author'])); | |
180 | 187 | core::event('pre_item',array('row'=>&$row),'view'); |
181 | 188 | } |
182 | 189 | static public function _blog_cb2(&$row){ |