www.gusucode.com > 25175 学生同学录管理系统 2007 build 1231D源码程序 > inc/tem_Notice_inc.asp

    <%
Function fun_Notice_list(tid)
	If tid="" Then tid=0
	If tid=0 Then 
		const MaxPerPage=10
		sql=Sqlinfo("id,n_tit,n_time","a25175_posts")
		strFileName="?"
		colnum="5"
		fun_Notice_list=fun_Notice_list & tem_funsqllist(sql,colnum,strFileName,MaxPerPage) 
		If outcom=True Then
		fun_Notice_list=fun_Notice_list & _
			get_Notice_list(MaxPerPage) &_
			tem_showpages(totalput,MaxPerPage)
		End If
		fun_Notice_list = "<ul id=""show_Notice_list"">" & fun_Notice_list & "</ul>"
	Else
		Dim rs_tem
		sql=Sqlinfo("n_tit,n_con,n_time,n_user","a25175_posts","id="&tid)
		rs_tem = connopen(sql)
		If isArray(rs_tem) Then
			fun_Notice_list="<H1>" & rs_tem(0,0) & "</H1>" & _
				"<H2>发布人:" & rs_tem(3,0) & " 时间:" & rs_tem(2,0) & "</H2>" & _
				"<div class=""con"">" & rs_tem(1,0) & "</div>"
		Else
			fun_Notice_list = " 参数错误!"
		End If
		fun_Notice_list = "<div id=""Notice_info"">" & fun_Notice_list & "</div>"
	End If 
End Function 

'****************************************************
'名称:showContent
'功能:翻页列表输出
'****************************************************
Function get_Notice_list(MaxPerPage)
	get_Notice_list=""
	dim i
	i=0
	do while not rs.eof
		get_Notice_list= get_Notice_list & "<li class=""list""><A HREF=""?tid=" & rs(0) & """>· &nbsp;" & rs(1) & "</A>" & _
			"<span>"&rs(2)&"</span>" & _
			"</li>"
		i=i+1
		if i>=MaxPerPage then exit do
		rs.movenext
	loop
end Function

Function tem_funsqllist(sql,colnum,strFileName,MaxPerPage)
	PurviewChecked=False
	if request("page")<>"" then
		currentPage=cint(request("page"))
	else
		currentPage=1
	end If
	set rs=server.createobject("adodb.recordset")
	
	rs.open sql,conn,3,2
	if rs.eof and rs.bof then
		funsqllist= "<li>Nothing.</li>"
	Else
		totalPut=rs.recordcount
		if currentpage<1 Then currentpage=1
		if (currentpage-1)*MaxPerPage>totalput then
			if (totalPut mod MaxPerPage)=0 then
				currentpage= totalPut \ MaxPerPage
			else
				currentpage= totalPut \ MaxPerPage + 1
			end if
		end If
		if currentPage<>1 then
			if (currentPage-1)*MaxPerPage<totalPut then
				rs.move  (currentPage-1)*MaxPerPage
				dim bookmark
				bookmark=rs.bookmark				
			else
				currentPage=1
			end If
		end If
		outcom=True
	end If
End Function

function tem_showpages(totalput,MaxPerPage)
	tem_showpages="<li class=""showpagesinfo"">"& vbcrlf & _
		"<script language=""JavaScript"">"& vbcrlf & _
		"var pg = new showPages('pg');"& vbcrlf & _
		"pg.pageCount ="&totalput \ MaxPerPage+1&";  // 定义总页数(必要)"& vbcrlf & _
		"pg.totalput ="&totalput&";  // "& vbcrlf & _
		"pg.MaxPerPage ="&MaxPerPage&"; "& vbcrlf & _
		"//pg.argName = 'p';  // 定义参数名"& vbcrlf & _
		"pg.printHtml(2);"& vbcrlf & _
		"</script>"& vbcrlf & _
		"</li>"& vbcrlf
End Function

%>