问题描述
<%@LANGUAGE="VBscript"CODEPAGE=65001%><%OptionExplicitResponse.Charset="UTF-8"Response.Buffer=TrueSession.CodePage=65001'----------------------------------------------------------------------------------'本页:'列表生成处理页面'说明:'LastModifyByLuzhu(TsysChina.Net)'----------------------------------------------------------------------------------%><!--#includefile="inc/Config.class.asp"--><!--#includefile="inc/DBControl.class.asp"--><!--#includefile="inc/FunctionLib.class.asp"--><!--#includefile="inc/Manager.class.asp"--><!--#includefile="inc/TagParser.class.asp"--><%DimCfg,Db,FLib,Admin,Fso,TParserDimProgramStart,TotalNum,FinishedNum,CurrPage,PageSizeProgramStart=TimerTotalNum=0FinishedNum=0SetCfg=NewConfigSetDb=NewDBControlSetFLib=NewFunctionLibSetAdmin=NewManagerSetFso=Server.CreateObject(Cfg.FileSystemObject_Name)SetTParser=NewTagParserIfNotAdmin.LoginedThenFLib.Alert"对不起,你已经超时或未登录","./",1Response.EndEndIfIfNotAdmin.CheckPopedom("TSYS_GROUP4_CREATE")ThenFLib.Alert"权限不足","BACK",0Response.EndENdIfDb.Open()DimWorkWork=Request("Work")'选择执行操作SelectCaseWorkCase"Create":StartCreate()CaseElseEndSelectFunctionStartCreate()Dimclass_list,allpage,MyclassArray,I,Rs,sqlclass_list=FLib.SafeSql(Request("class_list"))allpage=FLib.SafeSql(Request("allpage"))Ifclass_list="0"Thenclass_list=""Sql=ExeSql(3)SetRs=Db.ExeCute(Sql)WhileNotRs.Eofclass_list=class_list&","&Rs("ClassID")Rs.MoveNextWendclass_list=Mid(class_list,2)Rs.CloseSetRs=NothingEndIfMyclassArray=Split(class_list,",")ForI=0ToUBound(MyclassArray)CreateListMyclassArray(I),allpageNextFLib.Alert"生成完毕,本次生成共花费("&(Timer-ProgramStart)&")秒,详细:n1.符合生成条件数:"&TotalNum&"n2.实际生成成功数:"&FinishedNum&"n3.本次生成失败数:"&(TotalNum-FinishedNum)&"n---------------------------------------------------------------n生成时间:"&NOW(),"BACK",0Response.EndEndFunctionFunctionCreateList(class_id,allpage)DimPageCount,TotalResNum,list_path,list_name,real_list_path,template_path,class_title,listfile_name,class_url,CreatedPageDimRs,Sql,TempContentDimsqlWhere,sqlTemp'取得列表模板和生成列表路径Sql=ExeSql(2)sqlWhere="A.ClassIDIN("&class_id&")"Sql=Replace(Sql,"{sqlWhere}",sqlWhere)SetRs=Db.ExeCute(Sql)list_path=Rs("ListPathRule")list_name=Rs("ListNameRule")PageSize=Rs("ListNum")template_path=Rs("Path")class_title=Rs("Title")CreatedPage=Rs("CreatedPage")class_url=list_path&"/"&list_nameRs.CloseIfFLib.ChkPathType(list_path)=2Thenreal_list_path=Server.MapPath(list_path)Elsereal_list_path=Replace(list_path,"/","")EndIfIfNotFso.FolderExists(real_list_path)ThenFLib.CreateFolderreal_list_pathEndIf'取得数据的数目Sql=ExeSql(0)Ifclass_id<>"0"ThensqlWhere="ClassIN("&class_id&")ANDChecked=TrueANDDeleted=FalseANDCreated=True"EndIfSql=Replace(Sql,"{sqlWhere}",sqlWhere)SetRs=Db.ExeCute(Sql)TotalResNum=Rs(0)PageCount=Int((TotalResNum-1)/PageSize)+1Rs.CloseForCurrPage=1ToPageCountSql=ExeSql(1)Ifclass_id<>"0"ThensqlWhere="ClassIN("&class_id&")ANDA.Checked=TrueANDA.Deleted=FalseANDA.Created=True"EndIfSql=Replace(Sql,"{sqlWhere}",sqlWhere)Response.Write(Sql)SetRs=Db.CreateRS()Rs.PageSize=PageSizeRs.CacheSize=Rs.PageSizeRs.OpenSql,Db.Conn,1,1IfNot(Rs.EofAndRs.Bof)ThenRs.AbsolutePage=CurrPageEndIfTotalNum=TotalNum+1TempContent=FLib.ReadFromTextFile(template_path,Cfg.CharsetStr)TempContent=TParser.ListParser(class_id,class_title,class_url,PageSize,TotalResNum,PageCount,CurrPage,TempContent,Rs)IfCurrPage=1Thenlistfile_name=Replace(list_name,"{i}","")Elselistfile_name=Replace(list_name,"{i}",CurrPage)EndIfIfCreateRes(real_list_path&""&listfile_name,TempContent)=1ThenFinishedNum=FinishedNum+1EndIfNextSetRs=NothingEndFunctionFunctionExeSql(m)DimSqlIfm=0ThenSql="SELECTCOUNT(*)FROM"&Cfg.DataBase_Pre&"ArticleListWHERE{sqlWhere}"Elseifm=1ThenSql="SELECTTOP"&(CurrPage*PageSize)&"A.*,B.ClassID,B.TitleASClassTitleFROM"&Cfg.DataBase_Pre&"ArticleListASAINNERJOIN"&Cfg.DataBase_Pre&"ClassASBONA.Class=B.ClassIDWHERE{sqlWhere}ORDERBYA.ArticleIDDESC"Elseifm=11ThenSql="SELECTTOP"&((CurrPage+1)*PageSize)&"A.*,B.ClassID,B.TitleASClassTitleFROM"&Cfg.DataBase_Pre&"ArticleListASAINNERJOIN"&Cfg.DataBase_Pre&"ClassASBONA.Class=B.ClassIDWHERE{sqlWhere}ORDERBYA.ArticleIDDESC"Elseifm=2ThenSql="SELECTA.*,B.PathFROM"&Cfg.DataBase_Pre&"ClassALEFTJOIN"&Cfg.DataBase_Pre&"TemplateBONA.ListTemplate=B.TemplateIDWHERE{sqlWhere}"ElseSql="SELECT*FROM"&Cfg.DataBase_Pre&"Class"EndIf'输出SQLResponse.Write(Sql)ExeSql=SqlEndFunction'方法:创建列表(主方法)'参数:'path生成列表文件路径'TempContent资源所将要套用的模板内容'返回:'0生成失败'1生成成功FunctionCreateRes(path,TempContent)FLib.WriteToTextFilepath,TempContent,Cfg.CharsetStrIfErr.Number=0ThenCreateRes=1ElseCreateRes=0EndIfErr.Clear()EndFunction%>
解决方案
解决方案二:
太长。而且你说的是乱序还是乱码都不清楚。你可以找一个好使的分页函数去用。任何的CMS里都有。
解决方案三:
没有把问题说清楚啊……
解决方案四:
不好意思,是顺序乱了,麻烦帮看下