_table = 'portal_topic_pic'; $this->_pk = 'picid'; parent::__construct(); } public function count_by_topicid($topicid) { return $topicid ? DB::result_first('SELECT COUNT(*) FROM %t WHERE topicid=%d', array($this->_table, $topicid)) : 0; } public function fetch_all_by_topicid($topicid, $start = 0, $limit = 0) { return $topicid ? DB::fetch_all('SELECT * FROM %t WHERE topicid=%d ORDER BY picid DESC'.DB::limit($start, $limit), array($this->_table, $topicid)) : array(); } } ?>