.::: 一路问情 :::.
  • 注册
  • 登录
  • 会员
  • FTP资源中心
  • 七海争霸
  • 社区设施
  • 帮助
.::: 一路问情 :::. » 『建站技术』 » 自己写的{$动易系统-批量修改模版的小程序}
‹‹ 上一主题 | 下一主题 ››
发新话题
  • 发新话题
  • 发布投票
  • 发布商品
  • 发布悬赏
  • 发布活动
  • 发布辩论
  • 发布视频
打印

[技术] 自己写的{$动易系统-批量修改模版的小程序}

imsxl

初级会员

帖子
98 
威望
40 点 
金钱
215 元 
好评
133 点 
  • 个人空间
  • 发短消息
  • 加为好友
  • 当前离线
1楼 大 中 小 发表于 2008-2-26 18:12  只看该作者

自己写的{$动易系统-批量修改模版的小程序}

自己写的{$动易系统-批量修改模版的小程序}
前几天用动易的文章系统做了个站,开始的时候没有去精心管理模版,一味的做整体的网站策划,然后又忙于采集信息。要发布网站了,想把网站弄得漂亮点,才发现由于自己建的频道太多,再去把每个频道的每个模版去修改简直太麻烦,我的性格就是懒,否则不会用动易的系统,于是便写了个小程序。

程序小,功能小,但是却很实用---大家别笑话菜鸟。

PS:没有权限上传附件,只能把代码贴出来了,反正程序小,只有一个叶子。

代码如下:(贴进来可能有些变形,将就看吧)
<!--#include file="conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>修改模版</title>
<style type="text/css">
<!--
body,td,th {
        font-size: 12px;
}
body {
        margin-left: 0px;
        margin-top: 0px;
        margin-right: 0px;
        margin-bottom: 0px;
}
.input {
        border: 1px solid #006600;
}
.style1 {color: #FF0000}
.style2 {color: #009900}
-->
</style>
</head>
<!--
************************************************************************************************
功能介绍:实现修改相应“改动相同”的模版。
程序制作:长春大学生信息港(http://www.0431stu.com)
免责声明:本程序是恋飞的鸵鸟为自己维护网站所用,如果本程序存在BUG对您的网站造成损害,概不负责!
************************************************************************************************
-->
<body>
<%
dim objrs,str1,str2,temp
if request("action")="yes" then
  dim checkall,tps
  checkall=request("checkall")
  tps=request("tpId")
  response.write "<br><a href=z_Tp.asp>点击这里返回</a><br>替换进行中……<br>"
  OpenConn()
  set objrs= server.createobject("adodb.recordset")
  if checkall="yes" then
    sql="select * from PE_Template"
  else
    if tps="" then
          response.write "你还没有选择模版,请选择模版"
          response.end
        end if
    sql="select * from PE_Template where TemplateID in("&tps&")"
  end if
  objrs.open sql,conn,1,3
  str1=request("str1")
  str2=request("str2")
  while not objrs.eof
    temp=objrs("TemplateContent")
    objrs("TemplateContent")=replace(temp,str1,str2)
    objrs.update
    response.write objrs("TemplateName")&"----<font color=red>更新成功</font><br>"
    objrs.movenext
  wend
  objrs.close
  set objrs=nothing
  CloseConn()
else
%>
<table width="600"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#006600">
<form action="z_Tp.asp" method="post">
  <tr bgcolor="#FFFFFF">
    <td height="50" colspan="2"><div align="center">批量修改模版--代码替换(<span class="style1">注意:在进行此操作前一定要备份数据库</span>)</div></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td height="25" colspan="2"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="50%"><input onClick="window.tps.style.display='none';" type="radio" name="checkall" value="yes">
          所有模版</td>
        <td><input name="checkall" onClick="window.tps.style.display='';" type="radio" value="no" checked>
        自定义选择</td>
      </tr>
    </table></td>
    </tr>
  <tr id="tps" bgcolor="#FFFFFF">
    <td height="69" colspan="2">
        <%
        showChannel()
        %>
        <table width="100%">
        <%
        OpenConn()
        set objrs= server.createobject("adodb.recordset")
    sql="select * from PE_Template order by ChannelID"
    objrs.open sql,conn,1,3
        dim i
        i=1
        while not objrs.eof
          if i mod 2 = 1 then
            response.write "<tr>"
          end if
          response.write "<td width=50% > <input type=checkbox name=tpId value="&objrs("TemplateID")&">"&objrs("TemplateName")&"(<font color=red>"&objrs("ChannelID")&"</font>)</td>"
          if i mod 2 = 0 then
            response.write "</tr>"
          end if
          objrs.movenext
          i=i+1
        wend
        if i mod 2 = 0 then
          response.write "</tr>"
        end if
        objrs.close
        set objrs=nothing
        CloseConn()
        %>
        </table>
        </td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td width="152" height="112"><div align="right">被替换代码:</div></td>
    <td width="445" height="112"> <textarea name="str1" cols="50" rows="5" class="input"></textarea></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td height="107"><div align="right">替换成:</div></td>
    <td height="107"> <textarea name="str2" cols="50" rows="5" class="input"></textarea></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td height="30" colspan="2"><div align="center"><input name="action" type="hidden" value="yes"><input type="submit" value=" 提 交 ">
    </div></td>
    </tr>
  <tr valign="middle" bgcolor="#FFFFFF">
    <td height="107" colspan="2"><p>  功能介绍:实现修改<span class="style2">相应</span>“<span class="style1">改动相同</span>”的模版。</p>
      <p>  程序制作:<a href="http://www.0431stu.com">长春大学生信息港</a></p></td>
    </tr>
  </form>
</table>
</body>
</html>
<%
end if
function showChannel()
  response.write "<table width=100% >"
  dim csql,crs
  csql="select * from PE_Channel"
  OpenConn()
  set crs=server.createobject("adodb.recordset")
  crs.open csql,conn,1,1
  dim j
  j=1
  while not crs.eof
        if j mod 2 = 1 then
          response.write "<tr>"
        end if
    response.write "<td width=50% ><font color=red >"&crs("ChannelID")&"--"&crs("ChannelName")&"</font></td>"
        if j mod 2 = 0 then
          response.write "</tr>"
        end if
        j=j+1
    crs.movenext
  wend
  if j mod 2 = 0 then
        response.write "</tr>"
  end if
  crs.close
  set crs=nothing
  CloseConn()
  response.write "</table>"
end function
%>



QQ
UID
71049 
精华
0 
积分
40 
钻石
0 克拉 
宣传
0 点 
来路
搜索引擎 
阅读权限
10 
性别
女 
来自
安徽 
在线时间
14 小时 
注册时间
2008-2-19 
最后登录
2008-5-18 

查看详细资料

TOP

‹‹ 上一主题 | 下一主题 ››
发新话题
 

 

当前时区 GMT+8, 现在时间是 2008-7-9 16:21 蜀ICP备08000616号

清除 Cookies - 联系我们 - Ask Love - Archiver - WAP - TOP - 界面风格

  • 默认风格
  • 春意盎然
  • 宝石蓝
  • Wind
  • Blue
  • PCBETA
  • linstyle_free1
  • ARTERY_free6
  • 艺雅清爽
  • YUYU_Emera-x
  • HEIBBS

Powered by Discuz! 6.0.0,

Processed in 0.033637 second(s), 5 queries, Gzip enabled.

  • 控制面板首页
  • 编辑个人资料
  • 积分交易
  • 积分记录
  • 公众用户组
  • 个人空间管理
  • 资源中心
  • 名人堂
  • 社区银行
  • 醒目高亮
  • 勋章中心
  • 空间互踩
  • 便民查询
  • 邮箱图标
如果你喜欢一路问情,请同时向你的5个QQ好友宣传Sy64.Com,多谢支持!