如何为论坛编写线程?

发布于 2024-11-30 09:50:40 字数 336 浏览 1 评论 0原文

首先,我不是在寻找实际的代码;我什至不需要代码。

我只想了解我需要使用哪些工具以及我想要做的事情背后的逻辑,因为目前我不知道如何完成这项任务。

我正在尝试创建一个类似 stackoverflow 的论坛(不完全是论坛,但类似)。我感到困惑的部分是,当用户单击“提问”在论坛上创建新线程时,输入标题和问题本身并单击“提交线程”后,该线程如何放置在新容器中的主页?

我是否必须使用 html 创建一个容器并将其保存在数据库中,当用户单击“提交”时,该容器将回显到主页上?老实说,我不知道它会如何运作。请提前提供帮助并致谢。

PS我不是一个经验丰富的程序员,我有接近中级的经验,但我需要清晰的解释。

First off, i'm not looking for actual code; i don't even want code.

I just want to understand what tools i need to use and the logic behind what i'm trying to do because, at the moment i have no idea how to go about this task.

I'm trying to create a forum(not exactly a forum but similar) like stackoverflow. The part i'm confused about is, when a user clicks on "Ask Question" to create a new thread on the forum, after typing in the title and the question itself and clicking "submit thread", how does that thread get placed on the homepage in a new container?

Would i have to create a container using html and save it inside a database somehow and when the user clicks submit, that container would be echoed on to the homepage? I honestly have no idea how it would work. Please help and thanks in advance.

P.S I'm not a highly experienced programmer, i have close to intermediate experience but i need clear explanations.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

故事和酒 2024-12-07 09:50:40

一英里高的视野可能正是您目前所需要的。

您的数据库中有一个线程表,它有许多相关的信息。帖子标题、帖子所有者、发布时间、类别、标签、实际内容、更新时间

您的主页将对数据库运行查询,并查找按发布时间和更新时间排序的问题。

这将为您提供最近线程的列表,无论是新的还是最近回复的。

但是,如果您不确定其编码,并且目前无法考虑数据库组件,那么最好考虑使用现成的论坛、.Net Nuke、PHP Nuke、simple Machines论坛和许多其他内容都可以自由定制。

您甚至可以使用 Stack Overflow API 创建您自己的问答板!
以下是 Stack API 其他用法的网址:https://stackapps.com/

A mile high view is probably what you need at the moment.

You'd have in your database a table for threads, it would have a number of relevant pieces of information. Post title, Post owner, Time posted, Category, Tags, Actual content, time updated

Your homepage would run a query against the database and find questions ordering by Time Posted and time updated.

This would give you a list of recent threads, either new or recently replied to.

However, if you're not sure about the coding of this, and can't consider the database components at present, then it might be better to consider getting an off-the-shelf forum, .Net Nuke, PHP Nuke, simple Machines forum and many others are out there and freely customizable.

You can even use the Stack Overflow API to create your own Q&A board!
Here's a url for other usages of the Stack API: https://stackapps.com/

那请放手 2024-12-07 09:50:40

单击“提交线程”将在数据库中创建一个线程对象。然后,您可以使用该对象在主页上创建它的小视图,并在其自己的页面上创建它的完整视图。
基本上,主页后面的代码会向数据库询问按创建日期降序排列的 Thread 对象列表,并限制一定数量的对象,并用每条记录的数据填充模板。

Clicking "submit thread" would create a Thread object in your database. You could then use this object to create a small a view of it on your homepage, and a full view of it on its own page.
Basically, the code behind the homepage would ask the db for a list of Thread object ordered by descending creation date, and limited to a certain amount of object, and fill a template with the data for each record.

梦言归人 2024-12-07 09:50:40

只需使用谷歌查找一些论坛教程/示例,如果您在检查这些教程/示例后仍然有疑问,您可以回到这里并提出更具体的问题。
此外,编程上下文中的线程与论坛线程完全不同,仅供参考。

Just use google to find some forum tutorials/examples, if you still have questions after examining those you can come back here and ask more specific questions.
Also, threads in a programming context are completely different from a forum thread, just fyi.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文