论坛 newreply.php,discuz X3.1 快速回复 流程

一、嵌套回复

我参考的

http://www.liudon.org/?p=1079

也是在 forum_post 建立的 两个字段,由于涉及到程序的 修改,所以,才有了下面的 东西

二、快速回复  流程

以这个 url为例子: http://127.0.0.1/bbs/forum.php?

mod=post&action=reply&fid=53&tid=1171&repquote=2502&extra=page%3D1&page=1

提交回复后

第一步 最先访问的是  forum.php

最后一句 require DISCUZ_ROOT.'./source/module/forum/forum_'.$mod.'.php'; 根据 url 得知 ,这里的$mod = post

所以 实际上是 require DISCUZ_ROOT.'./source/module/forum/forum_post.php';

第二步

根据url 中的  action=reply , 在source/module/forum/forum_post.php中 342行左右

elseif($_GET['action'] == 'reply') {

$navtitle .= ' - '.$thread['subject'].' - '.$_G['forum']['name'];

require_once libfile('post/newreply', 'include');

}

根据require_once libfile('post/newreply', 'include');  知道这是 引入  source/include/post/post_newreply.php

第三步  在source/include/post/post_newreply.php中

$params 这个数组中存有一些信息,进一步 处理是在 $return = $modpost->newreply($params);  419行左右

第四步  source/class/model/model_post.php     方法newreply()

大约120行左右,$this->pid= insertpost(array()); 的作用就是  将回复信息的数据存入数据库 forum_post 表中

知道了 这个流程, 我是在第四步中的   $this->pid= insertpost(array()); 中 添加自己的字段赋值

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个简单的仿知乎评论和回复功能的 Vue 组件示例,仅供参考: ```vue <template> <div> <h2>评论区</h2> <div v-for="(comment, index) in comments" :key="index"> <div> <strong>{{ comment.username }}:</strong>{{ comment.content }} </div> <div> <button @click="replyIndex === index ? replyIndex = -1 : replyIndex = index"> 回复 </button> <div v-if="replyIndex === index"> <textarea v-model="newReply"></textarea> <button @click="addReply(index)">提交回复</button> </div> <div v-for="(reply, replyIndex) in comment.replies" :key="replyIndex"> <div> <strong>{{ reply.username }}:</strong>{{ reply.content }} </div> </div> </div> </div> <h2>发表评论</h2> <div> <label>用户名:</label> <input type="text" v-model="newComment.username"> </div> <div> <label>评论内容:</label> <textarea v-model="newComment.content"></textarea> </div> <button @click="addComment">提交评论</button> </div> </template> <script> export default { data() { return { comments: [ { username: '张三', content: '这是第一条评论', replies: [] }, { username: '李四', content: '这是第二条评论', replies: [] } ], newComment: { username: '', content: '' }, newReply: '', replyIndex: -1 } }, methods: { addComment() { if (this.newComment.username && this.newComment.content) { this.comments.push({ username: this.newComment.username, content: this.newComment.content, replies: [] }) this.newComment = { username: '', content: '' } } }, addReply(index) { if (this.newReply) { this.comments[index].replies.push({ username: '匿名用户', content: this.newReply }) this.newReply = '' this.replyIndex = -1 } } } } </script> ``` 在这个示例中,我们使用一个 comments 数组来存储所有的评论和回复。每个评论是一个对象,包含一个用户名和评论内容,以及一个 replies 数组,用于存储该评论的所有回复。每个回复也是一个对象,包含一个用户名和回复内容。 在组件中,我们使用 v-for 指令来遍历 comments 数组,并渲染每个评论和回复。为了实现回复功能,我们使用一个 replyIndex 变量来跟踪当前用户正在回复的评论的索引。当用户点击“回复”按钮时,我们将 replyIndex 设置为当前评论的索引,弹出一个文本框供用户输入回复内容。当用户提交回复时,我们将新的回复对象添加到当前评论的 replies 数组中,并将 replyIndex 设置为 -1,以便关闭回复框。 最后,我们还提供了一个“发表评论”区域,让用户输入新的评论。当用户点击“提交评论”按钮时,我们将新的评论对象添加到 comments 数组中,并清空输入框。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值