<?php
class indexAction extends publicAction {
   
   public function _initialize(){
   $this->lable('username','这里是标签');
  	//这里是初始化运行
   }
   public function index(){
 		 $_page=$_GET['page'];
	    if (!$_page) {$_page = 1;	}	
				$messagelist=$this->model->messagelist('','',($_page-1)*10,$_page*10);
				$page=new Pagination();
				$page->total =$this->model->messagetotal();
				$page->style_links = 'page';
				$page->style_results = 'pageno';
				$page->style_html = true;
				$page->page = $_page;
				
			    $page->page_style='category';////新加分类页分页2011/9/5 by laowantong
				
				$page->limit = 10;
				$page->text = '共{total}页　当前第{pages}页';
				$page->url = __APP__.'/index/index/page/{page}';			
				$this->data['page'] = $page->render();
				
				$this->data['text'] = $page->renderTotal();
				if(!$this->data['page'])$this->data['text']='共1页';
				$this->data['list']=$messagelist;
				$this->display();

   }
   public function post(){
   		$data=$_POST;   
   		$result=$this->model->addmessage($data);
		if($result)$this->error('留言成功',__URL__);
   
   }
   
  
}
?>