Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[HACK]发贴,回复,编辑帖子模板仿4.0附件上传双行显示 for 2.5 sp1

[复制链接]
肌肉猛男 发表于 2005-6-28 18:39:09 | 显示全部楼层 |阅读模式
名称: 发贴,回复,编辑模板仿4.0附件上传双行显示
適用: DZ 2.5 Sp1
作者: # Hack by 億萬富豪
作者网站: http://www.cnmuscle.com/bbs
头1次做修改,自己水平有限,难免有错误;但是系原创,希望转贴加上我的网址,谢谢合作。


第1步,创建模板文件,命名为post_attachments.htm,把下面代码按html格式保存。
下面是以10行(20个)附件为示例,若只有10个则把“attachnum < 10”改为“attachnum < 5”



  1. <script language="JavaScript">
  2. var attachnum = 1;
  3. function addattachment() {
  4.         attachnum < 10 ? attachnum++ : findobj("addattachlink").disabled=true;
  5.         findobj("attach_"+attachnum).style.display = "";
  6. }
  7. </script>

  8. <br>
  9. <table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="{TABLEWIDTH}" align="center" class="tableborder">
  10. <tr><td colspan="2" class="header">{lang attachment}<a id="addattachlink" href="###" onclick="addattachment(this.form)">[+]</a></td></tr>      
  11. <tr class="category"><td colspan="2">{lang attachment} ({lang lower_than} $maxattachsize_kb kb <!--{if $attachextensions}-->, {lang attachment_allow_exts}: $attachextensions<!--{/if}-->)</td></tr>
  12. <tbody id="attach_1" style=""><tr class="altbg2"><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
  13. <tbody id="attach_2" style="display: none"><tr class="altbg2"><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
  14. <tbody id="attach_3" style="display: none"><tr class="altbg2"><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
  15. <tbody id="attach_4" style="display: none"><tr class="altbg2"><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
  16. <tbody id="attach_5" style="display: none"><tr class="altbg2"><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
  17. <tbody id="attach_6" style="display: none"><tr class="altbg2"><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
  18. <tbody id="attach_7" style="display: none"><tr class="altbg2"><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
  19. <tbody id="attach_8" style="display: none"><tr class="altbg2"><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
  20. <tbody id="attach_9" style="display: none"><tr class="altbg2"><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
  21. <tbody id="attach_10" style="display: none"><tr class="altbg2"><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td><td width="50%"><!--{if $allowsetattachperm}-->{lang require} {lang credit_title}: <input type="text" name="attachperm[]" value="0" size="1">&nbsp; &nbsp;<!--{/if}-->&nbsp; &nbsp;{lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
  22. </table>
复制代码


第2步,修改模板文件
post_newthread.htm
找到

  1. <!--{if $allowpostattach && $multiattach}-->
  2. ..........................
  3. ..........................
  4. <!--{/if}-->
复制代码


改为

  1. <!--{if $allowpostattach && $multiattach}-->
  2.         {template post_attachments}
  3. <!--{/if}-->
复制代码


完成,假设你要改post_newreply.htm或者post_editpost.htm原理和第2步一样。

第3步,假设你post_newreply.htm或者post_editpost.htm不想和post_newthread.htm一样支持太多文件上传,就另外做一个模板post_attachments,把“attachnum < 10”改为“attachnum < 5”,并且attach_1只能到
attach_5.

[ 本帖最后由 億萬富豪 于 2005-6-28 18:43 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
PerfectWorks 发表于 2005-6-28 18:49:58 | 显示全部楼层
收了~不错~
回复

使用道具 举报

dreamnet 发表于 2005-6-28 18:50:52 | 显示全部楼层
用循环!
回复

使用道具 举报

ejew 发表于 2005-6-29 00:49:10 | 显示全部楼层
我改的比你简单的多了,而且附件的个数安后台自动设定,
不过我还没整理,当时修改后没记录

还是支持楼主的精神



已给出
https://discuz.dismall.com/viewth ... &extra=page%3D1

[ 本帖最后由 ejew 于 2005-6-30 05:36 编辑 ]
回复

使用道具 举报

 楼主| 肌肉猛男 发表于 2005-6-29 06:40:47 | 显示全部楼层
我是傻瓜型的修改,不能和各位大大比的,纯粹的傻瓜精神~~~~~~~~
回复

使用道具 举报

┚嘎嘎┎聖火 发表于 2005-6-29 08:05:12 | 显示全部楼层
支持一下原创
回复

使用道具 举报

ndren 发表于 2005-6-29 08:36:35 | 显示全部楼层
原帖由 ejew 于 2005-6-29 00:49 发表
我改的比你简单的多了,而且附件的个数安后台自动设定,
不过我还没整理,当时修改后没记录

还是支持楼主的精神


哇,快发布啊,,,嘿,非常期待。
回复

使用道具 举报

freddy 发表于 2005-6-29 09:32:20 | 显示全部楼层
支持原创~加精了~
回复

使用道具 举报

zxh 发表于 2005-7-3 21:44:38 | 显示全部楼层
支持一下原创
回复

使用道具 举报

ruokuang 发表于 2005-7-4 19:04:54 | 显示全部楼层
好东西就要顶
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-6-2 11:02 , Processed in 0.100595 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表