<?php
function get_fid($fid){
	global $db,$pre;
	$fid=intval($fid);
	$F[]=" FA.fid=$fid ";
	$query = $db->query("SELECT fid FROM {$pre}fu_sort WHERE fup='$fid'");
	while($rs = $db->fetch_array($query)){
		$F[]=" FA.fid=$rs[fid] ";
	}
	return $F;
}
$erp=$Fid_db[iftable][$fid];
if($fid){
	$f_id=get_fid($fid);
	$SQL=" (".implode("OR",$f_id).") ";
}
$SQLS="A LEFT JOIN {$pre}fu_article FA ON A.aid=FA.aid WHERE $SQL AND A.yz=1 GROUP BY A.aid ORDER BY A.hits DESC LIMIT 10";
$which='A.title,A.aid,A.fid';
$array=list_article($SQLS,$which,60,$erp);
$listhots="";
foreach($array AS $key1=>$rs){
	$listhots.="<div><a href='bencandy.php?fid=$rs[fid]&id=$rs[aid]'>$rs[title]</a></div>\r\n";
}
$SQLS="A LEFT JOIN {$pre}fu_article FA ON A.aid=FA.aid WHERE $SQL AND A.yz=1 GROUP BY A.aid ORDER BY A.levelstime DESC LIMIT 10";
$array=list_article($SQLS,$which,60,$erp);
$listcoms="";
foreach($array AS $key1=>$rs){
	$listcoms.="<div><a href='bencandy.php?fid=$rs[fid]&id=$rs[aid]'>$rs[title]</a></div>\r\n";
}
$GuideFid[$fid]="<a href='$webdb[www_url]'>首页</a> －&gt; 辅栏目";
@include(html("guide"));
?>
<!--
<?php
print <<<EOT
--> 
<link rel="stylesheet" type="text/css" href="$webdb[www_url]/images/sp/list.css">
<style>
.listfu{
	height:35px;
	line-height:35px;
	padding:0 5px;
	overflow:hidden;
	border-bottom:#DDD dotted 1px;
}
.listfu a{
	float:left;
	font-size:16px;
	color:#369;
}
.listfu span{
	float:right;
	color:#888;
}
</style>
<div style="width:1200px; text-align:center; overflow:hidden;">$label[list_top_ad]</div>
<div class="SpContainer">
	<div class="Main">
<!--
EOT;
foreach($listdb_moresort AS $key2=>$rss){
$morelist="";
foreach($rss[article] AS $key1=>$rs){
$morelist.="<div class='listfu'><a href='bencandy.php?fid=$rs[fid]&id=$rs[aid]' target='_blank'>$rs[full_title]</a><span>$rs[posttime]</span></div>\r\n";
}
print <<<EOT
-->
		<div class="sortBox">
			<div class="head"><span>$rss[name]</span><a href="fulist.php?fid=$rss[fid]">更多&gt;&gt;</a></div>
			<div class="cont">
				$morelist
			</div>
		</div>
<!--
EOT;
}
if($listdb){
$thislist="";
foreach($listdb AS $key=>$rs){
$rs[content]=@preg_replace('/<([^<]*)>/is',"",$rs[content]);	//把HTML代码过滤掉
$rs[content]=get_word($rs[content],200);
$thisimg=$rs[picurl]?"<dt><a href='bencandy.php?fid=$rs[fid]&id=$rs[aid]'><img src='$rs[picurl]' onerror=\"this.src='$webdb[www_url]/images/default/noimg.jpg'\"/></a></dt>\r\n":"";
$thislist.="<dl>\r\n{$thisimg}<dd><div><a href='bencandy.php?fid=$rs[fid]&id=$rs[aid]'>$rs[title]</a></div><p>$rs[content]</p><span>{$rs[posttime]}</span></dd>\r\n</dl>\r\n";
}
$showpage=$showpage?"<div class='ShowPage'>".$showpage."</div>":"";
print <<<EOT
-->
		<div class="ListSp">
			<div class="head"><span>$fidDB[name]</span></div>
			<div class="cont">
				$thislist
			</div>
			$showpage
		</div>
<!--
EOT;
}print <<<EOT
-->
	</div>
	<div class="Side">
		<div class="SideBox">
			<div class="head"><span>热门{$fidDB[M_alias]}</span></div>
			<div class="cont">
				$listhots
			</div>
		</div>
		<div class="SideBox">
			<div class="head"><span>推荐{$fidDB[M_alias]}</span></div>
			<div class="cont">
				$listcoms
			</div>
		</div>
		<div class="SideAd">{$label[article_list]}</div>
	</div>
</div>
<script type="text/javascript">
$('.Main img').hover(
	function(){
		$(this).animate({"max-width":"120%","max-height":"120%"},100);
	},
	function(){
		$(this).animate({"max-width":"100%","max-height":"100%"},100);
	}
);
</script>
<!--
EOT;
?>
-->