⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.asp

📁 一个简单ASP+ACCESS博客程序Simple Blog v1.2 。ASP虽然有些老了
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
' Project Name: Simple Blog
' Version: 1.1
' Author: James Tang
' Email: fwsous@gmail.com
' Web site: www.fwso.cn
' Copyright (C) 2008 James Tang. All Rights Reserved.
'
' Note: This program can be used for any purpose for free. 
'       
%>

<!--#include file="conn.asp"-->
<!--#include file="lib/util.asp"-->
<!--#include file="config.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="D2590DD1058AB71D1561927E463BCE85" />
<meta name="description" content="Simple blog, powered by James Tang (www.fwso.cn)" />
<meta name="keywords" content="fwso.cn, James Tang, Java, web development, SQL, JavaScript" />
<title><%=Application("blogName")%></title>
<link type="text/css" rel="stylesheet" href="css/blogStyle.css" />
<script type="text/javascript" language="javascript" src="../js/prototype.js"></script>
<script type="text/javascript" language="javascript"  src="js/SimpleCMS.js"></script>
</head>

<body>

<div id="mainDiv">
	<!--#include file="top.asp"-->

	<div id="stageDiv">
    
    	 <!--#include file="leftDIV.asp"-->
        
        <div id="rightDiv">
        	
            <%
			
			Dim showRS, showSQL
			Dim initPage, initRecord, initPageCount, initRecordCount
			Dim initStart			' The record that we are starting on.
			Dim initFinish			' The record that we are finishing on
			
			If Request.QueryString("cat_id") = "" then
				showSQL = "SELECT article_id, article_title,article_date,article_content, user_name, cat_name FROM articles AS a, users AS u, categories AS c WHERE a.user_id=u.user_id AND a.cat_id=c.cat_id ORDER BY article_date DESC"
			Else
				showSQL = "SELECT article_id, article_title,article_date,article_content, user_name, cat_name FROM articles AS a, users AS u, categories AS c WHERE a.user_id=u.user_id AND a.cat_id=c.cat_id AND c.cat_id=" & Request.QueryString("cat_id") &" ORDER BY article_date DESC"
			End If
			Set showRS = Server.CreateObject("ADODB.Recordset")
			showRS.open showSQL, conn, 1, 1
			
			
			If showRS.EOF or showRS.BOF then
				Response.Write("Have no article yet.")
				initPage = 1
				initPageCount = 1
			Else
				
				If Request.QueryString("page") = "" Then 
					initPage = 1 
				Else
					initPage = cInt(Request.QueryString("page"))
				End If
				
				showRS.PageSize = blogShows
				showRS.CacheSize = showRS.PageSize
				
				initPageCount = showRS.pageCount
				initRecordCount = showRS.RecordCount
				
				
				If cInt(initPage) > cInt(initPageCount) Then initPage = initPageCount End If
				If cInt(initPage) <= 0 Then initPage = 1 End If
				
				If initPageCount > 0 Then
					showRS.AbsolutePage = initPage
					initStart = showRS.AbsolutePosition
					If cInt(initPage) = cInt(initPageCount) Then
						initFinish = initRecordCount
					Else
						initFinish = initStart + (showRS.PageSize - 1)
					End If
				End if
				
				Do until initRecord = showRS.PageSize or showRS.EOF
			%>
        
         	<div id="showBox">
            	<div class="showTitle"><a href="./article.asp?article_id=<%=showRS("article_id")%>"><%=showRS("article_title")%></a></div>
                <div class="showInfo"><%=showRS("user_name")%> | <%=convertDatetime(showRS("article_date"))%>| <%=showRS("cat_name")%></div>
                
                <div class="showDesc">
                <p>
                	<%
					Dim more, content
					content = showRS("article_content")
					more = "<!--more-->"
					Response.Write(Split(content, more)(0))
					%>
                    <br />
                	<a href="./article.asp?article_id=<%=showRS("article_id")%>">Read More</a>
                 </p>
                </div><!--End #showDesc-->
            </div><!--End #showBox-->
            
            <%
				showRS.MoveNext
				initRecord = initRecord + 1
				Loop
			End If
			showRS.close
			Set showRS = nothing
			
			%>
            <%
			Dim currentURL
			currentURL = blogURL + "/?"
			If Request.QueryString("cat_id") <> "" Then
				currentURL = currentURL + "act_id=" + Request.QueryString("cat_id") + "&page="
			Else
				currentURL = currentURL + "page="
			End If
			%>
            <div id="navPages">
            <%
				If cInt(initPage) = 1 Then
					Response.Write("<span>Previous Page</span>")
				Else
			%>
            <span><a href="<%=currentURL + cStr(initPage - 1)%>">Previous Page</a></span>
            <%
				End If
			%>
            &nbsp;| &nbsp;
            <%
				If cInt(initPage) = cInt(initPageCount) Then
					Response.Write("<span>Next Page</span>")
				Else
			%>
            <span><a href="<%=currentURL + cStr(initPage + 1)%>">Next Page</a></span>
            <%
				End If
			%>
            </div><!--End #navPages-->
            
    	</div><!--End #rightDiv-->
        
    </div><!--End #stageDiv-->
    
    
    
    <!--#include file="bottom.asp"-->
	
</div><!--End #mainDiv-->

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -