名称: 发贴,回复,编辑模板仿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”
- <script language="JavaScript">
- var attachnum = 1;
- function addattachment() {
- attachnum < 10 ? attachnum++ : findobj("addattachlink").disabled=true;
- findobj("attach_"+attachnum).style.display = "";
- }
- </script>
- <br>
- <table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="{TABLEWIDTH}" align="center" class="tableborder">
- <tr><td colspan="2" class="header">{lang attachment}<a id="addattachlink" href="###" onclick="addattachment(this.form)">[+]</a></td></tr>
- <tr class="category"><td colspan="2">{lang attachment} ({lang lower_than} $maxattachsize_kb kb <!--{if $attachextensions}-->, {lang attachment_allow_exts}: $attachextensions<!--{/if}-->)</td></tr>
- <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"> <!--{/if}--> {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"> <!--{/if}--> {lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
- <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"> <!--{/if}--> {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"> <!--{/if}--> {lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
- <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"> <!--{/if}--> {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"> <!--{/if}--> {lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
- <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"> <!--{/if}--> {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"> <!--{/if}--> {lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
- <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"> <!--{/if}--> {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"> <!--{/if}--> {lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
- <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"> <!--{/if}--> {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"> <!--{/if}--> {lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
- <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"> <!--{/if}--> {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"> <!--{/if}--> {lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
- <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"> <!--{/if}--> {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"> <!--{/if}--> {lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
- <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"> <!--{/if}--> {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"> <!--{/if}--> {lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
- <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"> <!--{/if}--> {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"> <!--{/if}--> {lang attachment}: <input type="file" name="attach[]" size="15"></td></tr></tbody>
- </table>
复制代码
第2步,修改模板文件
post_newthread.htm
找到
- <!--{if $allowpostattach && $multiattach}-->
- ..........................
- ..........................
- <!--{/if}-->
复制代码
改为
- <!--{if $allowpostattach && $multiattach}-->
- {template post_attachments}
- <!--{/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 编辑 ] |
|