<?php
class Html_comment_Model extends Model{
	function __construct(){
		parent::__construct();
	}
	function  insert($data){
		return $this->db->insert("comment",$data);
	}
	
	function get($channelid,$conid,$page=1,$showlines=20){
		$this->db->select("sc.title,m.user_name,c.*");
		$this->db->join("search_cache as sc","sc.content_id","c.conid");
		$this->db->join("member as m","m.user_id","c.userid","left");
		$this->db->where("sc.channel_id",$channelid);
		$this->db->where("c.conid",$conid);
		$this->db->where("c.channelid",$channelid);
		$this->db->orderby("dtime","DESC");
		if($page){	$this->db->limit($showlines,$page*$showlines-$showlines);	}
		return $this->db->get("comment as c");
	}
}