Asp生成RSS的类 (今天写了一天刚完成的)最近经常看到RSS这几个字,不是很理解 于是在网上找了一大堆资料,了解了一下基本概念 但是没有找到一个方便的asp生成rss的类 索性自己今天写了一个 已经测试过了 加了使用方法的注释 在此和大家分享一下 我的blog同步发布的地址:http://www.ffasp.com/content.asp?newsid=637
<%
Dim Rs,Newrss
Class Rss
'========参数调用说明==================
'作者 : 飞飞
'网站 :[url=http://www.ffasp.com]www.ffasp.com[/url]
'QQ:276230416
'邮箱 :[url=mailto:huanmie913@163.com]huanmie913@163.com[/url]
'注:您可以更改和使用本程序,但请保留作者和出处
'*******************输入参数********************
'***********************************************
'SetConn 必填 网站使用的Connection对象
'SetSql 必填 Sql查询语句。强烈建议使用在Sql语句中使用Top要害字
' Sql语句中包含的字段[新闻Id,标题,内容,时间,静态页名称]
' 注:不要颠倒顺序
' 假如新闻不是生成的静态页,则无最后一项,SetPageType的值则为1
'SetWebName 必填 网站名称
'SetWebUrl 必填 网站的地址
'SetWebDes 非必填 网站的描述信息
'SetPageType 必填 信息显示页的链接类型 1 为动态页面Id0为静态页面
'SetMaxInfo 非必填 强制显示信息的数目,若取数据>SetMaxInfo 则显示SetMaxInfo条数据。强烈建议使用在Sql语句中使用Top要害字
'setContentShow非必填 信息简介设置。注重:该参数为数组(ShowContentType,ShowContentLen)
' ShowContentType[数字类型] 为内容显示方式[参数(0,1)0为按百分比就算显示信息,1为按字数]
' ShowContentLen内容显示的长度 由ShowContentType 决定实际长度
'*****************输出参数********************
'ShowRss显示Rss
'======================================================
'例如
'Set NewRss=New Rss
' Set NewRss.SetConn=article_conn
' NewRss.SetSql="select top 30 newsid,title,content,dateandtime,N_fname from article where typeid=1 order by newsid Desc"
' NewRss.SetWebName="测试中"
' NewRss.SetWebUrl="[url=http://www.ffasp.com/rss/rss.asp]http://www.ffasp.com/rss/rss.asp[/url]"
' NewRss.SetMaxInfo=10
' NewRss.SetInfourl="[url=http://www.ffasp.com]http://www.ffasp.com[/url]"
' NewRss.SetPageType="0"
' NewRss.setContentShow="1,200"
' NewRss.ShowRss()
'Set NewRss=Nothing
'======================================================
Private Conn,Sql,WebName,WebUrl,WebDes,Er,MaxInfo,i,Infourl,PageType
Private ShowContentType,ShowContentLen
Private AllContent,AllContentLen
Private Sub Class_initialize()
MaxInfo=20
'PageType=1
ShowContentType=0
ShowContentLen=20
Er=false
End Sub
Private Sub Class_terminate()
If isObject(Rs) then Set Rs=Nothing
End Sub
Public Property Let Errmsg(msg)
If Er then
Response.Clear()
Response.Write(msg)
Response.End()
End If
End Property
Public Property Let SetWebName(WebName_)
WebName=WebName_
End Property
Public Property Let SetWebUrl(WebUrl_)
WebUrl=WebUrl_
End Property
Public Property Let SetWebDes(webDes_)
WebDes=WebDes_
End Property
Public Property Let SetInfoUrl(Infourl_)
Infourl=Infourl_
End Property
Public Property Let SetPageType(PageType_)
PageType=PageType_
End Property
Public Property Let SetMaxInfo(MaxInfo_)
MaxInfo=MaxInfo_
End Property
Public Property Let setContentShow(ContentShow_)
Dim ArrContentShow
ArrContentShow=Split(ContentShow_,",")
If Ubound(ArrContentShow)<>1 Then Er=True:Errmsg="信息显示参数设置有误!!"
ShowContentType=ArrContentShow(0)
ShowContentLen=ArrContentShow(1)
If Not isnumeric(ShowContentType) or ShowContentType="" Then ShowContentType=0
If Not isnumeric(ShowContentLen) or ShowContentLen="" Then
If ShowContentType=0Then ShowContentLen=20 Else ShowContentLen=200
Else
If ShowContentType=0 and (ShowContentLen>100 or ShowContentLen<10) Then ShowContentLen=20
End If
End Property
Public Property Set SetConn(Conn_)
If TypeName(Conn_)="Connection"Then
Set Conn=Conn_
Else
Er=true
Errmsg="数据库连接错误"
Exit property
End If
End Property
Public Property Let SetSql(sql_)
Sql=Sql_
End Property
Public Property Get RssHead()
RssHead="<?xml version=""1.0"" encoding=""gb2312"" ?> "
文章地址: http://www.xinasp.com/html/yeshuowangzhan/zhanchangxiuxian/20071117/4124.shtml
TAG: 生成


RSS订阅
评论加载中…



