<?
		$iserror = 0;
		$db = new hon6mysql;
		$db -> mysql_link();
		
		$topicid = isset($topicid)?intval($topicid):0;
		
		$gettopic = $db->query_object("select ownerid,subject from ".JIEQI_DB_PREFIX."_article_replies where istopic=1 and topicid = ".$topicid);
		
		if(!$gettopic){
				$iserror = 1;
				$url = array();
				$tourl = URL_book_index($url);
				$pagecontent = "<b>回复失败：</b><br/>";
				$pagecontent .= "该主题不存在或已被删除！<br/>";
		}else{
				$bid = $gettopic->ownerid;
				$topictitle = $gettopic->subject;
				$articlename = $db->query_field("select articlename from ".JIEQI_DB_PREFIX."_article_article where articleid = ".$bid);
		}
		if($iserror == 0){
				/*自定义数据*/$pagelistnum = 10;//每页显示条数
				$totalrepley = $db->query_num("select * from ".JIEQI_DB_PREFIX."_article_replies where istopic=0 and topicid = ".$topicid);
				$totalpage = ceil($totalrepley/$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;
    		
				$smartydate = array("pagetitle" => $topictitle." 评论",
													"topictitle" => $topictitle,
													"totalpage" => $totalpage,
													"prevpage" => $page-1,
													"page" => $page,
													"nextpage" => $page+1,
													"pagelistnum" => $pagelistnum,
													"bid" => $bid,
													"topicid" => $topicid,
													"replynum" => $totalrepley,
													"articlename" => $articlename,
													"data" => array("topicid"=>$topicid),
														);
											
				$smartyObj->assign('replylist',$db->query_array("select * from ".JIEQI_DB_PREFIX."_article_replies where istopic=0 and topicid = ".$topicid." order by posttime desc limit ".$sqlstart.",".$pagelistnum));							
    		$smartyObj -> assign("gettopic",$db->query_object("select islock from ".JIEQI_DB_PREFIX."_article_reviews where topicid = ".$topicid));
    		
				$tplpath = "book/reviews_reply_list.tpl";
		}else{
				$smartydate = array("pagetitle" => "发表帖子",
														"pagecontent" => $pagecontent,
														"tourl" => $tourl,
														"redirecturl" => $tourl,
														);
														
				$tplpath = "public.tpl";
		}
?>