找回密码
 立即注册
搜索

途迹耕耘

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

GMT+8, 2025-12-22 04:11 , Processed in 0.076496 second(s), 14 queries .

[DZ教程] discuz viewthread.htm使用viewthread_node.htm和viewthread_node_body.htm中的代码

[复制链接]
bdk 发表于 2020-5-2 06:49:20 | 显示全部楼层 |阅读模式
不知如何描述 viewthread.htm、viewthread_node.htm、viewthread_node_body.htm这三个模板,也没有琢磨明白之间的关系,公开资料描述:
| -- template -- default -- forum -- viewthread.htm 看帖页面模板文件
| -- template -- default -- forum -- viewthread_node.htm 新回复节点模板文件
| -- template -- default -- forum -- viewthread_node_body.htm 主题回复节点模板文件
其中,是以viewthread.htm为主体,其中引入viewthread_node.htm和viewthread_node_body.htm,三个模板中功能代码不能随意移动使用。
通常,viewthread.htm想要使用其他两个模板里的代码,需要这样:
  1. <!--{loop $postlist $post}-->
  2. ……
  3. <!--{/loop}-->
复制代码
最近在做个模板下载站,在viewthread.htm测试了两段代码,一个是横排展示的小图,一个是供下载的附件,需要脱离帖子内容区域单独使用,代码如下:
横排小图:(代码来自viewthread_node_body.htm)
  1. <!--{loop $postlist $post}-->
  2.       <!--{if $post['attachment'] && $_GET['from'] != 'preview'}-->
  3.                         <div class="attach_nopermission attach_tips">
  4.                                 <div>
  5.                                         <h3><strong>{lang attach_nopermission_notice}</strong></h3>
  6.                                         <p><!--{if $_G['uid']}-->{lang attach_nopermission}<!--{elseif $_G['connectguest']}-->{lang attach_nopermission_connect_fill_profile}<!--{else}-->{lang attach_nopermission_login} <!--{hook/global_login_text}--><!--{/if}--></p>
  7.                                 </div>
  8.                                 <span class="atips_close" onclick="this.parentNode.style.display='none'">x</span>
  9.                         </div>
  10.                 <!--{elseif $post['imagelist'] || $post['attachlist']}-->
  11.                         <div class="pattl">
  12.                                 <!--{if $post['imagelist'] && $_G['setting']['imagelistthumb'] && $post['imagelistcount'] >= $_G['setting']['imagelistthumb']}-->
  13.                                         <!--{if !isset($imagelistkey)}-->
  14.                                                 <!--{eval $imagelistkey = rawurlencode(dsign($_G[tid].'|100|100'))}-->
  15.                                                 <script type="text/javascript" reload="1">var imagelistkey = '$imagelistkey';</script>
  16.                                         <!--{/if}-->
  17.                                         <!--{eval $post['imagelistthumb'] = true;}-->
  18.                                         <div class="bbda cl mtw mbm pbm">
  19.                                                 <strong>{lang more_images}</strong>
  20.                                                 <a href="javascript:;" onclick="attachimglst('$post[pid]', 0)" class="xi2 attl_g">{lang image_small}</a>
  21.                                                 <a href="javascript:;" onclick="attachimglst('$post[pid]', 1, {echo intval($_G['setting']['lazyload'])})" class="xi2 attl_m">{lang image_big}</a>
  22.                                         </div>
  23.                                         <div id="imagelist_$post[pid]" class="cl" style="display:none"><!--{echo showattach($post, 1)}--></div>
  24.                                         <div id="imagelistthumb_$post[pid]" class="pattl_c cl"><img src="{IMGDIR}/loading.gif" width="16" height="16" class="vm" /> {lang image_list_openning}</div>
  25.                                 <!--{else}-->
  26.                                         <!--{echo showattach($post, 1)}-->
  27.                                 <!--{/if}-->
  28.                         </div>
  29.                 <!--{/if}-->
  30.                 <!--{/loop}-->
复制代码
下载附件:(代码来自viewthread_node_body.htm)
  1. <!--{loop $postlist $post}-->
  2. <!--{if $post['attachlist']}-->
  3. <!--{eval echo showattach($post)}-->
  4. <!--{/if}-->
  5. <!--{/loop}-->
复制代码
暂时可以用,是否有问题还未知。