alert('参数传递有误,系统返回!');window.history.back(-1);"; die(""); } //更新浏览次数 $sql="update news set click=click+1 where id=$id"; mysql_query($sql); //获取新闻分类数组 $sql="select * from news where id=$id"; $result=mysql_query($sql); if($result){ $row=mysql_fetch_array($result); $title=$row["title"]; $zhuti=$row["zhuti"]; $arcwriter=$row["writer"]; $arcfrom=$row["froms"]; $arcedit=$row["editor"]; $content=$row["content"]; //$newsclass=$row["class"]; $class=$row["class"]; $writedate=$row["writedate"]; $keywords=$row["keywords"]; $description=$row["description"]; $scontent=mysubstr(strip_tags($content),0,300); $newsSql="select * from newsclass where id=$class"; $newsResult=mysql_query($newsSql); if($class==1){ $linksite="http://www.71jiu.com/news/list1";} if($class==2){ $linksite="http://www.71jiu.com/news/list2";} if($class==3){ $linksite="http://www.71jiu.com/news/list3";} if($class==4){ $linksite="http://www.71jiu.com/news/list4";} if($class==5){ $linksite="http://www.71jiu.com/news/list5";} if($class==6){ $linksite="http://www.71jiu.com/news/list6";} if($class==7){ $linksite="http://www.71jiu.com/news/list7";} if($class==8){ $linksite="http://www.71jiu.com/news/list8";} if($class==10){ $linksite="http://www.71jiu.com/news/list10";} if($class==11){ $linksite="http://www.71jiu.com/news/list11";} if($class==12){ $linksite="http://www.71jiu.com/news/list12";} if($class==13){ $linksite="http://www.71jiu.com/zhuanti/allzt";} if($newsResult){ if($newsRow=mysql_fetch_array($newsResult)){ $newsitem=$newsRow["classname"]; } } $clicknum=$row["click"]; $smarty->assign("newsid",$id); $smarty->assign("class",$newsitem); $smarty->assign("newsclasslink","$newsitem"); $smarty->assign("title",$title); $smarty->assign("newsitem",$newsitem); $smarty->assign("writer",$arcwriter); $smarty->assign("click",$clicknum); $smarty->assign("content",$content); $smarty->assign("scontent",$scontent); $smarty->assign("froms",$arcfrom); $smarty->assign("editor",$arcedit); $smarty->assign("writedate",$writedate); $smarty->assign("keywords",$keywords); $smarty->assign("description",$description); }else{ echo ""; die(""); } //检索上一遍文章 $sql="select * from news where id<$id order by id desc limit 0,1"; $result=mysql_query($sql); if($result){ if($row=mysql_fetch_array($result)){ $rowid=$row["id"]; $title=trim($row["title"]); $stitle=trim($row["title"]); if(strlen($title)>42) $stitle=mysubstr($title,0,42); $prenews="$stitle"; }else{ $prenews="没有了"; } } //检索下一遍文章 $sql="select * from news where id>$id limit 0,1"; $result=mysql_query($sql); if($result){ if($row=mysql_fetch_array($result)){ $rowid=$row["id"]; $title=trim($row["title"]); $stitle=trim($row["title"]); if(strlen($title)>40) $stitle=mysubstr($title,0,40); $nextnews="$stitle"; }else{ $nextnews="没有了"; } } //检索相关主题内容 $sql="select * from news where zhuti=$zhuti order by id desc limit 0,10"; $result=mysql_query($sql); if($result){ while($row=mysql_fetch_array($result)){ $rowid=$row["id"]; $title=$row["title"]; $ispic=$row["ispic"]; $writedate=$row["writedate"]; if($ispic==1) $xtitle=mysubstr(strip_tags($title),0,30)."(图)"; if($ispic!=1) $xtitle=mysubstr(strip_tags($title),0,34); //标题样式处理 //====================================================== $titlestyle=$row["titlestyle"]; $xtitle=newsstyle($xtitle,$titlestyle); //======================================================= $xgxw[]=array("title"=>"·$xtitle"); } } //检索图片信息 $sql="select * from news where picpath<>0 and class=$class order by id desc limit 0,3"; $result=mysql_query($sql); while($row=mysql_fetch_array($result)){ $rowid=$row["id"]; $title=$row["title"]; $writedate=$row["writedate"]; $ispic=$row["ispic"]; $class=$row["class"]; $picpath=$row["picpath"]; if($ispic==1) $xtitle=mysubstr(strip_tags($title),0,28); if($ispic!=1) $xtitle=mysubstr(strip_tags($title),0,28); //标题样式处理 //====================================================== $titlestyle=$row["titlestyle"]; $xtitle=newsstyle($xtitle,$titlestyle); //======================================================= $news[]=array("id"=>$rowid,"pic"=>$picpath,"title"=>$title,"xtitle"=>$xtitle); } //检索最新资讯 $sql="select * from news where grade<>0 order by id desc limit 0,10"; $result=mysql_query($sql); if($result){ while($row=mysql_fetch_array($result)){ $rowid=$row["id"]; $title=$row["title"]; $ispic=$row["ispic"]; $writedate=$row["writedate"]; if($ispic==1) $xtitle=mysubstr(strip_tags($title),0,32)."(图)"; if($ispic!=1) $xtitle=mysubstr(strip_tags($title),0,36); //标题样式处理 //====================================================== $titlestyle=$row["titlestyle"]; $xtitle=newsstyle($xtitle,$titlestyle); //======================================================= $zxzx[]=array("title"=>"·$xtitle"); } } //检索热点资讯 $sql="select * from news where grade<>0 order by click desc limit 0,10"; $result=mysql_query($sql); if($result){ while($row=mysql_fetch_array($result)){ $rowid=$row["id"]; $title=$row["title"]; $ispic=$row["ispic"]; $writedate=$row["writedate"]; if($ispic==1) $xtitle=mysubstr(strip_tags($title),0,32)."(图)"; if($ispic!=1) $xtitle=mysubstr(strip_tags($title),0,36); //标题样式处理 //====================================================== $titlestyle=$row["titlestyle"]; $xtitle=newsstyle($xtitle,$titlestyle); //======================================================= $hotnews[]=array("title"=>"·$xtitle"); } } //检索推荐产品 $sql="select * from product where pclass=0 and msggrade=2 and pisopen=1 order by rand() limit 0,8"; $result=mysql_query($sql); if($result){ while($row=mysql_fetch_array($result)){ $rowid=$row["id"]; $pname=$row["pname"]; $pspic=$row["pspic"]; $xpname=mysubstr(strip_tags($pname),0,14); $product[]=array("id"=>$rowid,"pic"=>$pspic,"name"=>$pname,"xname"=>$xpname); } } $smarty->assign("prenews",$prenews); $smarty->assign("nextnews",$nextnews); $smarty->assign("zxzx",$zxzx); $smarty->assign("hotnews",$hotnews); $smarty->assign("news",$news); $smarty->assign("product",$product); $smarty->assign("xgxw",$xgxw); $smarty->caching = true; $smarty->cache_lefetime = 86400; $my_cache_id = $_GET['id']; if($class==7){ $smarty->display("newszsview.html","$my_cache_id");} else{ $smarty->display("newsview.html","$my_cache_id"); } ?>