<?php
if (!defined('ROOT')) exit('Can\'t Access !'); 
class mod_news extends module_class{
	function main(){
       $typeid = $_GET['typeid'];
	   $where = "where id>'0' ";
	   if($typeid) $where .= "and typeid='{$typeid}'";
	   $pagetotal = $this->pagetotal = $this->mysql->counts("select * from {$this->pre}news $where");
	   $this->pageclass($pagetotal);
	   $this->news = $this->mysql->getarr("select * from {$this->pre}news $where order by addtime desc limit ".$this->page->start.",".$this->page->size);  
	   $this->type = $this->mysql->getarr("select * from {$this->pre}newstype order by `typeorder` asc");
    }
	
 	function show(){
	   $this->news = $this->mysql->select_one("select * from {$this->pre}news where id='{$_GET[id]}' ");  
	   if(!is_array($this->news))  $this->message('go_back','对不起，该信息不存在');
	   $this->type = $this->mysql->getarr("select * from {$this->pre}newstype order by `typeorder` asc");
	}
	
	
}
?>