<?php

class indexModel extends Model {
   
  
   public function messagelist($str,$order,$start,$limit){
       $form=D("message");//快速实例化表
	   
	 
	  if(!$order)$order='sendtime desc';
	  $dblist=$form->where($str)->order($order)->select();//快速获得数据
	  for($i=(int)$start;$i<(int)$limit;$i++){
	  
	  $result[]=$dblist[$i];
	 
	  }
	  return $dblist;

   }
   public function messagetotal($str=''){
   		 $form=D("message");		 
   		$dblist=$form->where($str)->total();	 
	  return $dblist;
   
   }
   public function addmessage($data){
   
	$form=D("message");
	$form->field['title']=$data['title'];
	$form->field['content']=$data['content'];
   return  $form->add();
   }
  
  
}
?>