public function fetch_all_by_sql($where, $order = '', $start = 0, $limit = 0, $count = 0, $alias = '') { $where = $where && !is_array($where) ? " WHERE $where" : ''; if(is_array($order)) { $order = ''; } if($count) { return DB::result_first('SELECT count(*) FROM '.DB::table($this->_table).' %i %i %i '.DB::limit($start, $limit), array($alias, $where, $order)); } return DB::fetch_all('SELECT * FROM '.DB::table($this->_table).' %i %i %i '.DB::limit($start, $limit), array($alias, $where, $order)); } |
class table_portal_article_content extends discuz_table { public function fetch_all_by_sql($where, $order = '', $start = 0, $limit = 0, $count = 0, $alias = '') { $where = $where && !is_array($where) ? " WHERE $where" : ''; if(is_array($order)) { $order = ''; } if($count) { return DB::result_first('SELECT count(*) FROM '.DB::table($this->_table).' %i %i %i '.DB::limit($start, $limit), array($alias, $where, $order)); } return DB::fetch_all('SELECT * FROM '.DB::table($this->_table).' %i %i %i '.DB::limit($start, $limit), array($alias, $where, $order)); } |
</p> <p> foreach($query as $article) { $ids .= ','.$article['aid']; $num++; } |
if($num==0){ list($srchtxt, $srchtxtsql) = searchkey($keyword, "content LIKE '%{text}%'", true); $query = C::t('portal_article_content')->fetch_all_by_sql(' 1 '.$srchtxtsql, 'ORDER BY aid DESC ', 0, $_G['setting']['search']['portal']['maxsearchresults']); foreach($query as $article) { $ids .= ','.$article['aid']; $num++; } } |
版权声明: 本站资源均来自互联网或会员发布,如果侵犯了您的权益请与我们联系,我们将在24小时内删除!谢谢!
转载请注明: discuzx文章进行全文检索的实现方法