asp 生成feed文件代码

<%

function AddSiteURL(ByVal Str)
  If IsNull(Str) Then
   AddSiteURL = ""
   Exit Function
  End If

  Dim re
  Set re=new RegExp
  With re
    .IgnoreCase =True
    .Global=True
   
    .Pattern="<img (.*?)src=""(?!(http|https)://)(.*?)"""
    str = .replace(str,"<img $1src=""" & SiteURL & "$3""")
   
    .Pattern="<a (.*?)href=""(?!(http|https|ftp|mms|rstp)://)(.*?)"""
    str = .replace(str,"<a $1href=""" & SiteURL & "$3""")
  End With
  Set re=Nothing

  AddSiteURL=Str
End Function

'==================================
'  Feed日志订阅
'    更新时间: 2005-11-19
'==================================
'读取Blog设置信息
  getInfo(1)

'写入关键字列表
  Keywords(1)

'写入表情符号
  Smilies(1)
 
Response.Charset = "UTF-8"
Response.ContentType="text/xml"
Response.Expires=60
Response.Write("<?xml version=""1.0"" encoding=""UTF-8""?>")
Dim cate_ID,FeedCate,FeedTitle,memName,FeedRows
cate_ID=CheckStr(Request.QueryString("cateID"))
FeedCate=False
FeedTitle=UnCheckStr(SiteName)
IF IsInteger(cate_ID) = False Then
 SQL="SELECT TOP 10 L.log_ID,L.log_Title,l.log_Author,L.log_PostTime,L.log_Content,L.log_edittype,C.cate_Name FROM blog_Content AS L,blog_Category AS C WHERE C.cate_ID=L.log_cateID AND L.log_IsShow=true AND L.log_IsDraft=false and C.cate_Secret=false ORDER BY log_PostTime DESC"
Else
 SQL="SELECT TOP 10 L.log_ID,L.log_Title,l.log_Author,L.log_PostTime,L.log_Content,L.log_edittype,C.cate_Name FROM blog_Content AS L,blog_Category AS C WHERE log_cateID="&cate_ID&" AND C.cate_ID=L.log_cateID AND L.log_IsShow=true AND L.log_IsDraft=false and C.cate_Secret=false ORDER BY log_PostTime DESC"
    FeedCate=True
End IF
Dim RS,DisIMG,i
Set RS=Conn.ExeCute(SQL)
if RS.EOF or RS.BOF then
 ReDim FeedRows(0,0)
 else
   if FeedCate then FeedTitle=UnCheckStr(SiteName & " - " & RS("cate_Name"))
 FeedRows=RS.getrows()
end if
RS.close
set RS=nothing
Conn.Close
Set Conn=Nothing
%>
<rss version="2.0">
<channel>
<title><![CDATA[<%=FeedTitle%>]]></title>
<link><%=SiteURL%></link>
<description><![CDATA[<%=blog_Title%>]]></description>
<language>zh-cn</language>
<copyright><![CDATA[Copyright 2005 PBlog2 v2.4]]></copyright>
<webMaster><![CDATA[<%=blog_email%>(<%=blog_master%>)]]></webMaster>
<generator>PBlog2 v2.4</generator>
<image>
 <title><%=SiteName%></title>
 <url><%=SiteURL%>images/logos.gif</url>
 <link><%=SiteURL%></link>
 <description><%=SiteName%></description>
</image>
<%
if ubound(FeedRows,1)=0 then
   Response.Write("<item></item>")
 else
 for i=0 to ubound(FeedRows,2)
  %>
   <item>
   <link><%=SiteURL&"default.asp?id="&FeedRows(0,i)%></link>
   <title><![CDATA[<%=FeedRows(1,i)%>]]></title>
   <author><%=blog_email%>(<%=FeedRows(2,i)%>)</author>
   <category><![CDATA[<%=FeedRows(6,i)%>]]></category>
   <pubDate><%=DateToStr(FeedRows(3,i),"w,d m y H:I:S")%></pubDate>
   <guid><%=SiteURL&"default.asp?id="&FeedRows(0,i)%></guid> 
  <%
   'IF RS("log_IsShow")=False Then
   ' Response.Write("<description><![CDATA[这是篇隐藏日志,请到 "&SiteName&" 的首页查看!]]></description>")
   'Else
            IF FeedRows(5,i)=0 then
                Response.Write("<description><![CDATA["&AddSiteURL(UnCheckStr(FeedRows(4,i)))&"]]></description>")
               else
                Response.Write("<description><![CDATA["&AddSiteURL(UBBCode(HTMLEncode(FeedRows(4,i)),0,0,0,1,1))&"]]></description>")
      end if
   'End IF
  %>
  </item>
  <%
 next
end if%>
</channel>
</rss>

时间: 2024-09-17 22:25:53

asp 生成feed文件代码的相关文章

asp生成xml文件代码

 代码如下 复制代码 <!--#include file="config.asp"--> <% Dim Rs,SQL,foundstr Dim classid,ChildStr Dim RssBody,RssTitle,RssHomePageUrl Dim XMLDOM,node,Cnode,Cnode1,msginfo Set XMLDOM = Server.CreateObject("Microsoft.FreeThreadedXMLDOM")

asp生成静态文件代码

<% Dim Rs,SQL,HtmlContent Dim ChannelRootDir,strInstallDir,strIndexName Dim flashid,downid,showurl,ErrMsg Dim strTitle,strAddress,addTime Dim AllHits,Introduce,filesize Dim HtmlFileUrl,HtmlFileName,strUrl Newasp.ReadChannel(ChannelID) ChannelRootDir

如何使用ASP生成HTML文件

生成html 使用ASP生成HTML文件,共有两个页面index.htm是首页.程序比较简单,主要是用了ASP里的文件操作对象. <!--index.htm----------------------> <html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=g

5种php生成swf 文件代码

/* 下面这几款php生成flash文件代码,是从简单的生成swf文件到生成 flash动画文件等,每个实例都是经典的. */ //首先开启php扩展php_ming $f = new swffont( '_sans' ); $t = new swftextfield(); $t->setfont( $f ); $t->setcolor( 0, 0, 0 ); $t->setheight( 400 ); $t->addstring( 'hello world' ); $m = ne

php生成pdf文件代码(1/12)

<? //php教程生成pdf文件代码 /* 生成pdf文件如果真的生成很好,是很复杂的,下面我们来看看一款完整理的php生成pdf文件代码吧,他可以把文本文件生成pdf文件也可以利用图片文件生成pdf文件哦. 这款生成pdf文件用到文件有 fpdf.php chinese.php picpdf.php */ //fpdf.php代码 define('fpdf_version','1.6'); class fpdf { var $page;               //current pag

使用ASP生成HTML文件的实例代码

生成html 共有两个页面index.htm是首页.程序比较简单,主要是用了ASP里的文件操作对象. <!--index.htm-------------------------------------------------------------------------------><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/htm

使用ASP生成HTML文件

 '共有两个页面index.htm是首页.程序比较简单,主要是用了ASP里的文件操作对象.   <!--index.htm---------------------->   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  "http://www.w3.org/TR/html4/loose.dtd">  <html>  <head>  <

实例演示:使用ASP生成HTML文件

生成html 共有两个页面index.htm是首页.程序比较简单,主要是用了ASP里的文件操作对象.  <!--index.htm---------------------->  <!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN" ""> <html> <head> <title>UntitledDocument</title> &l

asp 生成验证码实例代码

asp教程 生成验证码实例代码 call com_creatvalidcode("validcode") sub com_creatvalidcode(ps教程n)     ' 禁止缓存   response.expires = -1   response.expiresabsolute = now() - 1    response.cachecontrol = "no-cache"      'response.expires = -9999      'res