在动易2006 SP6中添加自定义asp函数的过程

来源:互联网 发布:sql查询去除重复数据 编辑:程序博客网 时间:2024/05/09 01:55
由于工作的需要,现在动易2006 sp6模板中添加新浪的博客文章列表。经过笔者一番探索后,可以这样来实现

1、在根目录中找到 Start.asp文件,并且在该文件最后添加自定义的asp函数(注意:自定义函数必须有返回

值),并在文件开始定义函数的返回值变量。
   举例:现在要将我的新浪博客文章列表放到我的动易2006中,能够在动易首页显示博客文章列表
   1>函数代码(line 399):
     Function ReadSinaRss()
dim xmlDoc
dim http
dim bitem
dim bi
dim title
dim link
dim xmlseed
xmlseed="http://blog.sina.com.cn/rss/adsbaby.xml"
Set http=Server.CreateObject("Microsoft.XMLHTTP")
http.Open "GET",xmlseed,False
http.send
Set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.Async=False
xmlDoc.ValidateOnParse=False
xmlDoc.Load(http.ResponseXML)
Set bitem=xmlDoc.getElementsByTagName("item")
if bitem.Length>=0 then
ReadSinaRss="<table width=100% cellpadding=0 cellspacing=0>"
For bi=0 To (bitem.Length-1)
 if bi<=5 then
  Set title=bitem.Item(bi).getElementsByTagName("title")
  Set link=bitem.Item(bi).getElementsByTagName("link")
   if len(title.Item(0).Text)>=20 then
    title.Item(0).Text=left(title.Item(0).Text,20)
   end if
   ReadSinaRss=ReadSinaRss&"<tr><td width=10 valign=top class=><img

src=/Article/images/Article_common3.gif alt=普通文章></td><td class=><a href="""& link.Item

(0).Text &""" target='_blank'>"& title.Item(0).Text&"</a></td></tr>"
 end if
Next
ReadSinaRss=ReadSinaRss&"</table>"
end if
End Function
   2>、定义顶部的变量(line 23)
       Dim SinaBlogStr

   3>、调用定义的函数,并将函数的返回值给变量SinaBlogStr (line 100)
       SinaBlogStr= ReadSinaRss()
通过上面的函数调用后,变量SinaBlogStr里已经有新浪博客的文章列表了。因为后续的文件中会调用该文件

,所以后续的文件只要调用SinaBlogStr函数就可以了。


2、在根目录的Editor目录中找到Editor_tree.asp,并且在478行添加一行:
   <DIV class=subItem onClick="InsertLabel('{$SinaBlogStr}')"><IMG class=icon

src="images/label.gif">显示新浪博客</DIV> (line 479)
   这行的功能是在后台的“网站通用标签”中添加新浪博客列表标签 

3、在根目录的Include目录下找到PowerEasy.Common.Front.asp,并且在2267行添加一行:
   strHtml = PE_Replace(strHtml, "{$SinaBlogStr}", SinaBlogStr)'新浪博客文章
   这样行的功能是将变量设置为一个标签

自此,新浪博客文章列表的标签添加好了,接下去只要在后天添加该标签到相应的地方就可以了。

原创粉丝点击