define( array( columnMain => "main.tpl", //显示栏目信息主模板 threadCircleInfo => "userarticle_row.tpl", //循环主题 bottom => "bottom.tpl", erroInfo => "erro.tpl" //错误提示 ) ); $coolcond=($coolflag)?"and ($bbstable.fdCool=1 or $bbstable.fdWebCool=1)":""; $intLineNum=10; if($intGotoPage <= 0) $intGotoPage=1; $start = ($intGotoPage-1)*$intLineNum; //起始记录数 /* function check_GroupId($login) { global $loginstr,$member,$DB_web; $return=0; $sql="select fdGroupId from $member where fdLogin='$login'"; $memberinfo1 = $DB_web->query_first($sql); if($memberinfo[fdGroupId]==1){ //管理员 $return=1; } if($loginstr==$login) //自己 $return=1; return $return; } //文章总数 if (check_GroupId($user)){ $sql="SELECT count(id) as id from $bbstable where fdLogin='$user'"; } else{ */ $sql="SELECT count($bbstable.id) as id from $bbstable,$bbscolumn where $bbstable.fdLogin='$user' and $bbstable.fdColumnId=$bbscolumn.id and $bbscolumn.fdIsPublic=1 $coolcond"; //} $totals = $DB_web->query_first($sql); $totalnum = $totals[id]; if(!$intLineNum) $intLineNum=1; $totalpages = intval($totalnum/$intLineNum); if( ($totalnum%$intLineNum)<>0 ) $totalpages = $totalpages+1; if($totalpages<=0) $totalpages=1; /* if (check_GroupId($user)){ $mainsql = "SELECT * from $bbstable where fdLogin='$user' order by id desc limit $start,$intLineNum"; } else{ */ $mainsql = "SELECT $bbstable.* from $bbstable,$bbscolumn where $bbstable.fdLogin='$user' and $bbstable.fdColumnId=$bbscolumn.id and $bbscolumn.fdIsPublic=1 $coolcond order by $bbstable.id desc limit $start,$intLineNum"; //} $result = $DB_web->query($mainsql); $rowsNum = $DB_web->num_rows($result); $i = $rowsNum; $tpl->define_dynamic("row", "threadCircleInfo"); while($i>0) { $i--; if ($bbstable==$bbsarticle){ $article_result = $DB_web->fetch_array($result); } else{ $r_rows=$DB_web->fetch_array($result); $s_sql="select * from $bbsarticle where id=$r_rows[fdArticleId] order by id"; $r_result = $DB_web->query($s_sql); $article_result =$DB_web->fetch_array($r_result); } $attribute=$article_result[fdAttack]?" [有附件]":""; $infoimage1=(substr($article_result[fdReplyDate],0,10)==date('Y-m-d'))?"新回的帖子":""; $infoimage2=(substr($article_result[fdCreateDate],0,10)==date('Y-m-d'))?"新发的帖子":""; $infoimage=$infoimage1; $infoimage=(strlen($infoimage2)>5)?$infoimage2:$infoimage; //定义循环模板中的变量 $cool=($article_result[fdCool])?"酷帖 ":""; $fdReplyAuthor=($article_result[fdReplyAuthor])?($article_result[fdReplyAuthor]):($article_result[fdLogin]); $tpl->assign( array( startinfo => "", endinfo => "", infoimage => $infoimage, topimage => ($article_result[fdIsTop]) ? "置顶" : "", faceimage => $article_result[fdGraph], title_href => "showthread.php?bbstable=$bbstable&threadid=".intval($article_result[id]), articletitle=> $cool.mark($article_result[fdTitle]).$attribute, bity => strlen($article_result[fdContent]), author => "
$article_result[fdLogin]
".substr($article_result[fdCreateDate], 5 ,11)."", reply => ($article_result[fdReply] >= $columninfo[fdHotReply]) ? "".$article_result[fdReply]."" : $article_result[fdReply], hits => ($article_result[fdHits] >= $columninfo[fdHotHits])? "".$article_result[fdHits]."" : $article_result[fdHits], score =>"".$article_result[fdPoint]."/".$article_result[fdHitPoint]."", morepages => $morepages, lastpostdate => "
$fdReplyAuthor
".substr($article_result[fdReplyDate], 5 ,11)."
" ) );//end: $tpl->assign( $tpl->parse(ROWS,".row"); //解析循环的单元 }//end: while($i>0){ if($totalnum>$intLineNum)//显示分页 { $morepages = intShowPages($totalnum,$intGotoPage,$totalpages); } else{ } if ($rowsNum){ $tpl->assign( array( column_title => $fdWebSiteName."--".$columninfo[fdName], totalthreads => $totalnum, bannertitle => $columninfo[fdContent], bulltin => $bulltinmessage, guideindex => $index, guidetarget => $target, thiscolumnname => $columninfo[fdName], banner => ($justbanner) ? $justbanner : "暂无斑竹", assistant => ($assistantbanner) ? $assistantbanner : "暂无副斑竹", bannerwords => $columninfo[fdWords], newthread => ($fdColumnId)?"showcolumn.php?fdColumnId=$fdColumnId":"admin/pm.php", JSCODE => $javascriptcode, totalpeople => totalpeople(), totalpost => totalpost(), highpeople => highpeople(), title => $fdWebSiteName, bgmusic => (strlen($fdBgSound)>10)?"":"", loginform => $logininfo, morepages => $morepages, sortpublish => $hrefstring."&sortarticle1=fdCreateDate", sortreply => $hrefstring."&sortarticle1=fdReply", sorthit => $hrefstring."&sortarticle1=fdHits", sortreplydate => $hrefstring."&sortarticle1=fdReplyDate", publishsort => ($sortarticle1=='fdCreateDate')?($sorttype):"", replysort => ($sortarticle1=='fdReply')?($sorttype):"", hitsort => ($sortarticle1=='fdHits')?($sorttype):"", replydatesort => ($sortarticle1=='fdReplyDate')?($sorttype):"", isCool => ($isCool)?"?fdColumnId=$fdColumnId":"?fdColumnId=$fdColumnId&isCool=1", isCoolname => ($isCool)?"":"", ) ); } if ($i<=0){ $tpl->assign( array( startinfo => "", endinfo => "", infoimage => "", topimage => "", faceimage => "", title_href => "", articletitle=> "", loginform => $logininfo, JSCODE => $javascriptcode, bgmusic => "", bity => "", author => "", reply => "", hits => "", score =>"", morepages => $morepages, lastpostdate => "" ) ); } $tpl->parse(main, ".threadCircleInfo"); //解析循环的模板 $tpl->parse(bottominfo, "bottom"); //解析底部模板模板 $tpl->parse(main, "columnMain"); //解析主模板模板 $tpl->FastPrint(); //分页函数 function intShowPages($intLineNum,$intGotoPage,$totalpages){ global $fdColumnId,$flag,$sortdesc,$isCool,$user,$bbstable,$coolflag; $intWhileNum=10; $intSelfLine=$intGotoPage; #本页 $intStartPage=(($intSelfLine-1)-(($intSelfLine-1)%$intWhileNum)); $intEndPage=$intStartPage+$intWhileNum-1; if($totalpages<$intEndPage){ $intEndPage=$totalpages-1; $intWhileNum=$intEndPage-$intStartPage+1; } $sortdesc1=($sortdesc=="asc")?"desc":"asc"; $return=""; $next_page=$intSelfLine+1; #下一页的页数 $return.="
  "; for($i=1;$i<$intWhileNum+1;$i++){ $intOffsetNum=($intStartPage+($i-1))*$intLineNum; $intShowPage=($intStartPage+$i); if($intSelfLine==$intStartPage+$i){ #当前页不做联接 $return.=" ".$intShowPage." "; }else{ if($intShowPage<=$totalpages){ $return.=" ".$intShowPage.""; } } } $return.="   
当前 $intSelfLine/$totalpages 页 跳转到 第"; $return.=""; $return.="
"; return $return; } ?>