<?
//error_reporting(0);

include("global.php");

$class=addslashes($_GET["class"]);

$id=intval($_GET["id"]);

if($class=="" || $id=="")
{
	die("错误参数");
}

if($class=="news")
{
	
	
	//获取类
	$mysql->query("select * from nclass");

	while($array=$mysql->fetcharray())
	{
		$bigclass[]=$array['id'].'$'.$array['name'];
	}
	
	//print_r($bigclass);
	
	foreach($bigclass as $key=>$value)
	{
		$bigclassname[$key]=explode("$",$value);
	}
	
	//获取详情
	
	$arr=$mysql->onequery("select * from news where id=$id");
	
	//print_r($arr);
	//smarty注册
	
	$tpl->assign("title",$arr['title']);
	
	$tpl->assign("time",$arr['time']);
	
	$tpl->assign("editor",$arr['editor']);
	
	$tpl->assign("content",$arr['content']);
	
	$tpl->assign("bigclassname",$bigclassname);
	
	$tpl->display("show.tpl");
	
}


if($class=="product")
{
	//获取类
	$mysql->query("select * from pclass");

	while($array=$mysql->fetcharray())
	{
		$bigclass[]=$array['id'].'$'.$array['name'];
	}
	
	//print_r($bigclass);
	
	foreach($bigclass as $key=>$value)
	{
		$bigclassname[$key]=explode("$",$value);
	}
	
	
	//获取详情
	
	$arr=$mysql->onequery("select * from product where id=$id");
	
	
	//获取相关图片或附件
	
	$mysql->query("select * from attachment where aid=$id");
	
	while($about=$mysql->fetcharray())
	{
		$aboutlist[]=$about["attach"];
	}
	
	//print_r($arr);
	//smarty注册
	
	$tpl->assign("aboutlist",$aboutlist);
	
	$tpl->assign("title",$arr['title']);
	
	$tpl->assign("time",$arr['time']);
	
	$tpl->assign("editor",$arr['editor']);
	
	$tpl->assign("content",$arr['content']);
	
	
	
	$tpl->assign("bigclassname",$bigclassname);
	
	$tpl->display("show.tpl");
	
}
?>