·设为首页收藏本站📧邮箱修改🎁免费下载专区📒收藏夹👽聊天室📱AI智能体
返回列表 发布新帖

关于帖子分类信息的问题?

192 2
发表于 2024-10-31 13:40:42 | 查看全部 阅读模式

马上注册,免费下载更多dz插件网资源。

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

×
如何分类信息内容一直显示,意思就是访客、设在购买主题的帖子 分类信息 内容依然显示。
我在模板里 viewthread_node_body.htm 找到了这段分类信息代码,我把这段代码移到的模板的顶端,可以实现了此功能,但是有个问题就是,所有回复的帖子也会显示这个分类,但我这需要主题显示即可。。这个不知如何解决?请高手指教下。。。
  1.   <!--{if $threadsort && $threadsortshow}-->                        <!--{if $threadsortshow['typetemplate']}-->                                $threadsortshow[typetemplate]                        <!--{elseif $threadsortshow['optionlist']}-->                                <div class="typeoption">                                        <!--{if $threadsortshow['optionlist'] == 'expire'}-->                                                {lang has_expired}                                        <!--{else}-->                                                <table summary="{lang threadtype_option}" cellpadding="0" cellspacing="0" class="cgtl mbm">                                                        <caption>$_G[forum][threadsorts][types][$_G[forum_thread][sortid]]</caption>                                                        <tbody>                                                                <!--{loop $threadsortshow['optionlist'] $option}-->                                                                        <!--{if $option['type'] != 'info'}-->                                                                                <tr>                                                                                        <th>$option[title]:</th>                                                                                        <td><!--{if $option['value'] !== ''}-->$option[value] $option[unit]<!--{else}-->-<!--{/if}--></td>                                                                                </tr>                                                                        <!--{/if}-->                                                                <!--{/loop}-->                                                        </tbody>                                                </table>                                        <!--{/if}-->                                </div>                        <!--{/if}-->                <!--{/if}-->
复制代码

我知道答案 回答被采纳将会获得1 贡献 已有1人回答
我要说一句 收起回复

评论2

浅生Lv.8 发表于 2024-10-31 13:41:17 | 查看全部
通过多次摸索,终于找到了解决方法,供大家参考:


解决方法: \template\default\forum\viewthread_node_body.htm
29-53行代码删除,将以下代码粘贴到顶部第二行 <div class="pcb"> 代码下即可。
  1. <!--{if $post['first']}-->                 <!--{if $threadsort && $threadsortshow}-->                        <!--{if $threadsortshow['typetemplate']}-->                                $threadsortshow[typetemplate]                        <!--{elseif $threadsortshow['optionlist']}-->                                <div class="typeoption">                                        <!--{if $threadsortshow['optionlist'] == 'expire'}-->                                                {lang has_expired}                                        <!--{else}-->                                                <table summary="{lang threadtype_option}" cellpadding="0" cellspacing="0" class="cgtl mbm">                                                        <caption>$_G[forum][threadsorts][types][$_G[forum_thread][sortid]]</caption>                                                        <tbody>                                                                <!--{loop $threadsortshow['optionlist'] $option}-->                                                                        <!--{if $option['type'] != 'info'}-->                                                                                <tr>                                                                                        <th>$option[title]:</th>                                                                                        <td><!--{if $option['value'] !== ''}-->$option[value] $option[unit]<!--{else}-->-<!--{/if}--></td>                                                                                </tr>                                                                        <!--{/if}-->                                                                <!--{/loop}-->                                                        </tbody>                                                </table>                                        <!--{/if}-->                                </div>                        <!--{/if}-->                <!--{/if}--> <!--{/if}-->
复制代码
我要说一句 收起回复
Discuz智能体Lv.8 发表于 2025-3-16 20:34:18 | 查看全部
要实现只在主题帖子中显示分类信息,而在回复帖子中不显示,你可以通过判断当前帖子是否是主题帖子来控制分类信息的显示。具体来说,你可以在 `viewthread_node_body.htm` 模板中使用 `$post['first']` 变量来判断当前帖子是否是主题帖子。

以下是一个示例代码,展示如何实现这个功能:

  1. <!-- 判断是否是主题帖子 -->
  2. <!--{if $post['first']}-->
  3.     <!-- 显示分类信息 -->
  4.     $threadsortshow
  5.     {lang has_expired}
  6.     $_G
  7.     $option:
  8.     $option $option-
  9. <!--{/if}-->
复制代码


### 解释:
1. `$post['first']` 是一个布尔值,当它为 `true` 时,表示当前帖子是主题帖子(即楼主发布的帖子)。
2. 通过 `<!--{if $post['first']}-->` 判断当前帖子是否是主题帖子,如果是,则显示分类信息。
3. 如果不是主题帖子(即回复帖子),则不会显示分类信息。

### 操作步骤:
1. 打开 `viewthread_node_body.htm` 模板文件。
2. 找到你之前移动的分类信息代码。
3. 将分类信息代码包裹在 `<!--{if $post['first']}-->` 和 `<!--{/if}-->` 之间。

### 示例:
  1. <!--{if $post['first']}-->
  2.     <!-- 分类信息代码 -->
  3.     $threadsortshow
  4.     {lang has_expired}
  5.     $_G
  6.     $option:
  7.     $option $option-
  8. <!--{/if}-->
复制代码


这样,分类信息就只会显示在主题帖子中,而不会显示在回复帖子中。

如果你有其他问题或需要进一步的帮助,请随时提问!
-- 本回答由 人工智能 AI智能体 生成,内容仅供参考,请仔细甄别。
我要说一句 收起回复

回复

 懒得打字嘛,点击右侧快捷回复【查看最新发布】   【应用商城享更多资源】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

AI智能体
投诉/建议联系

discuzaddons@vip.qq.com

未经授权禁止转载,复制和建立镜像,
如有违反,按照公告处理!!!
  • 联系QQ客服
  • 添加微信客服

联系DZ插件网微信客服|最近更新|Archiver|手机版|小黑屋|DZ插件网! ( 鄂ICP备20010621号-1 )|网站地图 知道创宇云防御

您的IP:3.144.115.82,GMT+8, 2025-5-2 05:54 , Processed in 0.399945 second(s), 77 queries , Gzip On, Redis On.

Powered by Discuz! X5.0 Licensed

© 2001-2025 Discuz! Team.

关灯 在本版发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表