www.gusucode.com > 全球营销软件站整站源码4月最新数据 4.0源码程序 > 801wyxqf\ask\topshare.asp

    <!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<%
Dim HtmlContent,XMLDom,FoundSQL
Dim AskedPageList,strLink,topicmode,showmode,HeadTitle
Dim maxperpage,CurrentPage,Pcount,totalrec,totalnumber
Dim MaxTopicRecord
MaxTopicRecord = Newasp.ChkNumeric(NewAsp.Posts_Setting(34))
If MaxTopicRecord = 0 Then MaxTopicRecord = 500
maxperpage = Newasp.ChkNumeric(NewAsp.Posts_Setting(29))
If maxperpage = 0 Then maxperpage = 20
CurrentPage = NewAsp.ChkNumeric(Request("page"))
If CurrentPage = 0 Then CurrentPage = 1
showmode = NewAsp.ChkNumeric(Request("mode"))

Select Case showmode
	Case 1
		HeadTitle = "最新分享主题"
		FoundSQL = " WHERE topicmode=3 And LockTopic=0 ORDER BY LastPostTime DESC"
	Case 2
		HeadTitle = "最新热门分享"
		FoundSQL = " WHERE topicmode=3 And LockTopic=0 ORDER BY Hits DESC, LastPostTime DESC"
	Case 3
		HeadTitle = "最新广播分享"
		FoundSQL = " WHERE topicmode=3 And LockTopic=0 And Broadcast=1 ORDER BY LastPostTime DESC"
	Case Else
		HeadTitle = "最新分享主题"
		FoundSQL = " WHERE topicmode=3 And LockTopic=0 ORDER BY TopicID DESC"
End Select
HtmlContent = NewAsp.LoadTemplate("topasking")

HtmlContent = Replace(HtmlContent, "{$HeadTitle}", HeadTitle)
HtmlContent = Replace(HtmlContent, "{$Current}", HeadTitle)
HtmlContent = Replace(HtmlContent, "{$ClassID}", 0)

LoadTopiclist()
Response.Write NewAsp.ArchiveHtml(HtmlContent)
NewAsp.CloseConn()

Sub LoadTopiclist()
	Dim SQL,Rs,topiclist,Node
	Set XMLDom = NewAsp.CreateXMLDoc("msxml2.FreeThreadedDOMDocument"& MsxmlVersion)
	XMLDom.appendChild(XMLDom.createElement("xml"))
	XMLDom.documentElement.setAttribute "action",1
	XMLDom.documentElement.setAttribute "showmode",showmode
	XMLDom.documentElement.setAttribute "topicmode",topicmode
	totalrec = 0:Pcount = 1
	If Not IsObject(Conn) Then ConnectionDatabase
	Set Rs = NewAsp.CreateAXObject("ADODB.Recordset")
	SQL="SELECT Top "& MaxTopicRecord &" TopicID,classid,userid,classname,title,PostUsername,Expired,Closed,PostTable,DateAndTime,LastPostTime,LockTopic,Reward,Hits,PostNum,CommentNum,TopicMode,Highlight,Broadcast,Anonymous,IsTop FROM NC_Ask_Topic " & FoundSQL
	Rs.Open SQL,Conn,1,1
	If Not (Rs.BOF And Rs.EOF) Then
		totalrec = CLng(Rs.recordcount) '###记录总数
		Pcount = CLng(totalrec / maxperpage)  '得到总页数
		If Pcount < totalrec / maxperpage Then Pcount = Pcount + 1
		If Pcount < 1 Then Pcount = 1
		If CurrentPage < 1 Then CurrentPage = 1
		If CurrentPage > Pcount Then CurrentPage = Pcount
		If CurrentPage >1 Then
			Rs.Move (CurrentPage-1) * maxperpage
		End If
	End If
	If Not Rs.EOF Then
		SQL=Rs.GetRows(maxperpage)
		Set topiclist=NewAsp.ArrayToxml(SQL,Rs,"row","topic")
	Else
		Set topiclist=Nothing
	End If
	Set Rs=Nothing
	SQL=Empty
	XMLDom.documentElement.setAttribute "headtitle",HeadTitle
	XMLDom.documentElement.setAttribute "pagesize",maxperpage
	XMLDom.documentElement.setAttribute "page",CurrentPage
	XMLDom.documentElement.setAttribute "totalnumber",totalrec
	XMLDom.documentElement.setAttribute "totalrec",totalrec
	XMLDom.documentElement.setAttribute "pagecount",Pcount
	If Not topiclist Is Nothing Then 
		For Each Node in topiclist.documentElement.SelectNodes("row")
			Node.selectSingleNode("@title").text=NewAsp.Checkstr(Node.selectSingleNode("@title").text)
			Node.selectSingleNode("@dateandtime").text=NewAsp.FormatDate(Node.selectSingleNode("@dateandtime").text,5)
			'Response.Write Node.selectSingleNode("@title").text
		Next
		XMLDom.documentElement.appendChild(topiclist.documentElement)
		Set topiclist=Nothing
	End If
	strLink = NewAsp.InstallDir & "topshare.asp?mode=" & showmode & "&"
	AskedPageList = showlistpage(CurrentPage,Pcount,strLink)
	transform_topicList()
	HtmlContent = Replace(HtmlContent, "{$AskedPageList}", AskedPageList)
End Sub

Sub transform_topicList()
	Dim proc,XMLStyle,node,cnode,XSLTemplate
	Set XSLTemplate=NewAsp.CreateAXObject("Msxml2.XSLTemplate" & MsxmlVersion )
	Set XMLStyle=NewAsp.CreateXmlDoc("msxml2.FreeThreadedDOMDocument"& MsxmlVersion )
	XMLStyle.load Server.MapPath(NewAsp.TemplatePath & "xslt/topasking.xslt")
	Set Node=XMLStyle.createNode(1,"xsl:variable","http://www.w3.org/1999/XSL/Transform")
	Set CNode=XMLStyle.createNode(2,"name","")
	CNode.text="installdir"
	Node.attributes.setNamedItem(CNode)
	Node.text=NewAsp.InstallDir
	XMLStyle.documentElement.appendChild(node)
	Set Node=XMLStyle.createNode(1,"xsl:variable","http://www.w3.org/1999/XSL/Transform")
	Set CNode=XMLStyle.createNode(2,"name","")
	CNode.text="AskedPageList"
	Node.attributes.setNamedItem(CNode)
	Node.text=AskedPageList
	XMLStyle.documentElement.appendChild(node)
	Set Node=XMLStyle.createNode(1,"xsl:variable","http://www.w3.org/1999/XSL/Transform")
	Set CNode=XMLStyle.createNode(2,"name","")
	CNode.text="skinurl"
	Node.attributes.setNamedItem(CNode)
	node.text=NewAsp.AskedSkinUrl
	XMLStyle.documentElement.appendChild(node)
	XSLTemplate.stylesheet=XMLStyle
	Set proc = XSLTemplate.createProcessor()
	proc.input = XMLDom
	proc.transform()
	Dim procstr
	procstr = proc.output
	'Response.Write  procstr
	HtmlContent = Replace(HtmlContent, "{$Topiclist}", procstr)
	'Response.Write XMLDom.xml
	Set XMLDom=Nothing 
	Set proc=Nothing
	Set XMLStyle=Nothing
	Set XSLTemplate=Nothing
End Sub
%>