<?
		$iserror = 0;
		
		global $rank;
		
		//$listuser -> checklogin($_Ge["member"]["uid"]);
		
		if($cid == ""){
				$iserror = 1;
				$url = array();
				$tourl = URL_book_index($url);
				$pagecontent = "<b>提醒：</b><br/>";
				$pagecontent .= "栏目ID不能为空！<br/>";
				$pagecontent .= ">>".backurl()."<br/>";	
		}else{
				@$sortname = iconv("gbk","utf-8",$jieqiSort['article'][$cid]["shortname"]);
				if($sortname == ""){
						//$iserror = 1;
						$sortname = "未分类";	
				}
		}
		
		if($iserror == 0){
				switch($rank){
						case 1:
								$rankway='allvisit';
								$rankname='点击';
								$num_rows = $db -> query_num('select * from jieqi_article_article where sortid='.$cid);//获取总记录数
								break;
						case 2:
								$rankway='lastupdate';
								$rankname='新书';
								$num_rows = $db -> query_num('select * from jieqi_article_article where sortid='.$cid);//获取总记录数
								break;
						case 3:
								$rankway=0;
								$rankname='全本';
								$num_rows = $db -> query_num('select * from jieqi_article_article where sortid='.$cid.' and fullflag=1');//获取总记录数
								break;
						case 4:
								$rankway=1;
								$rankname='连载';
								$num_rows = $db -> query_num('select * from jieqi_article_article where sortid='.$cid.' and fullflag=0');//获取总记录数
								break;
						default:
								$rankway='allvisit';
								$rankname='点击';
								$num_rows = $db -> query_num('select * from jieqi_article_article where sortid='.$cid);//获取总记录数
								break;
				}
		}
		if($iserror == 0){
				/*自定义数据*/
				$pagelistnum = 10;//每页显示条数（修改此项设置后需要删除所有目录缓存）
				$totalpage = ceil($num_rows/$pagelistnum);
				$page = isset($page)?intval($page):"1";
				$page = ($page>$totalpage)?($totalpage):($page);
				$totalpage = ($totalpage==0)?1:intval($totalpage);
				$page = ($page<1)?(1):($page);
				$sqlstart = ($page-1)*$pagelistnum;
				switch($rank){
					case 1:
						$sql='select * from jieqi_article_article where sortid='.$cid.' order by allvisit desc limit '.$sqlstart.','.$pagelistnum;
						break;
					case 2:
						$sql='select * from jieqi_article_article where sortid='.$cid.' order by lastupdate desc limit '.$sqlstart.','.$pagelistnum;
						break;
					case 3:
						$sql='select * from jieqi_article_article where sortid='.$cid.' and fullflag=1 order by allvisit desc limit '.$sqlstart.','.$pagelistnum;
						break;
					case 4:
						$sql='select * from jieqi_article_article where sortid='.$cid.' and fullflag=0 order by lastupdate desc limit '.$sqlstart.','.$pagelistnum;
						break;
					default:
						$sql='select * from jieqi_article_article where sortid='.$cid.' order by allvisit desc limit '.$sqlstart.','.$pagelistnum;
						break;
				}

		}
		if($iserror == 0){
				$smartydate = array("pagetitle" => $sortname." - ".$rankname." - 分类",
													"sortname" => $sortname,
													"num_rows" => $num_rows,
													"rank" => $rank,
													"page" => $page,
													"pagelistnum" => $pagelistnum,
													"data" => array("cid"=>$cid,"rank"=>$rank),
													"booklist" => $db->query_array($sql),
													"totalpage" => $totalpage,
														);
				$tplpath = "book/class.tpl";
		}else{
				$smartydate = array("pagetitle" => "提醒",
													"pagecontent" => $pagecontent,
													"tourl" => $tourl,
													"redirecturl" => $tourl,
														);
				$tplpath = "public.tpl";
		}

?>