首页 开发指南

2013-07-13 村上桐树2,532

5UCMS留言板插件开发指南

读完这一片文章,你就能自己开发自己想要的5UCMS留言板插件!

首先,本文的插件以网络流行的插件为蓝本。

留言本,在企业站点当中充当着询盘管理的角色,即使是在个人博客中,留言本也是站长和访客交流的友好工具,那么打造一款适合自己站点的留言板就显得尤为重要,本文交你如何改造属于自己的留言本。

”,对于5ucms插件来说,首先要操作的就是在后台安装插件表,控制这个插件表的数据则位于插件文件夹下的setting.xml,这个文件一方面是记录插件的设置记录,更重要的是这个文件是创建插件表的首要记录,找到如下代码:

<install><![CDATA[
ACCESS:Create Table [{pre}Guestbook] ([ID] Int IDENTITY (1, 1) NOT NULL PRIMARY KEY,[Title] Varchar(50),[Tel] Varchar(100),[Email] Varchar(100),[User] Varchar(10),[Content] Varchar(250),[Recomment] Varchar(250),[Ip] Varchar(20),[Time] DateTime Default {date},[State] Int Default 0)
MSSQL:Create Table [{pre}Guestbook] ([ID] Int IDENTITY (1, 1) NOT NULL PRIMARY KEY,[User] Varchar(20),[Content] Varchar(500),[Recomment] Varchar(500),[Ip] Varchar(40),[Time] DateTime Default {date},[State] Int Default 0)
]]></install>

看到了啊,读到这里,你应该明白,如何建立自己所需求的字段了吧!

加入你添加了一个字段,那么你相应的就要修改一下几个文件:

”个:_Manage.Class.ASP中的:

Class Cls_Guestbook

Dim vID
Dim vTitle
Dim vTel
Dim vEmail
Dim vUser
Dim vContent
Dim vRecomment
Dim vIp
Dim vTime
Dim vState
Dim LastError

声明标量的部分,将你添加的字段声明出来;

Public Function GetValue()中获取你添加的变量;(Public Function GetValue()这个函数中的变量,来自于_manage.asp文件中的<form name=’frm’ method=’post’ action='<%=Url%>?Act=UpDate&ID=<%=ID%>&Page=& lt;%=Page%><%=JumpUrl%>’>这个表单,所以在这里获取之前,还要按照相应的是在这个表单中创建相应的 input用来作为相应字段的容器)

Public Function SetValue()中添加相应的字段;

Public Function Modify()添加相应的字段;

接下来是save.asp文件了,这个文件是处理提交留言数据的,找到以下部分,声明相应的变量:

Dim Comment_Title,Comment_Tel,Comment_Email,Comment_User,Comment_Content

接下来是获取变量:Comment_Title=Request(“title”)

然后是过滤数据中的不安全字符:

Comment_Title = Replace(Comment_Title,”<“,””)
Comment_Title = Replace(Comment_Title,”>”,””)
Comment_Title = Replace(Comment_Title,”asp”,””)
Comment_Title = Replace(Comment_Title,”%”,””)

然后找到sql执行语句:

‘Dim Rs,SQL
‘SQL = “Select [ID],[Title],[Tel],[Email],[User],[Content],[IP],[Time],[State] From [{pre}Guestbook]”
‘Set Rs = DB(SQL,3)
‘Rs.Addnew
‘Rs(“title”)=Comment_Title
‘Rs(“tel”)=Comment_Tel
‘Rs(“email”)=Comment_Email
‘Rs(“user”) = Comment_User
‘Rs(“content”) = Comment_Content
‘Rs(“ip”) = GetIP
‘Rs(“time”) = Now()
‘If Plus.Config(“audit”) = 1 Then Rs(“state”) = 0 Else Rs(“state”) = 1
‘Rs.update
‘Rs.Close

修改完毕以后你的留言板就可以正常运行了。

 

回复 Stuart Moniot 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注

会员评论:(共一条评论)

声明:本站所有主题/文章除标明原创外,均来自网络转载,版权归原作者所有,如果有侵犯到您的权益,请联系本站删除,谢谢!
©www.sbmzenith.com 2013-2022 All Rights Reserved.
豫ICP备15009393号