Tags: From scratch development project, title: From scratch to write project sixth [Personal Favorites]


Comment function information

It’s not uncommon to have comments on the web, and I’d like to add comments to my site to let others know what they think of my site, and to let others tell me what’s wrong.

So I went to find the corresponding information to go, before the comment function did not understand….

The following blogger believes that comments can be divided into three types:

Blog.csdn.net/u010098331/…

  • Both reply and comment can be regarded as comments, and @xxx can be used as reply, similar to comments of IOS Zhihu (this is the easiest way).
  • Separate responses from comments, either by adding a parent attribute to a single table, or by dividing two tables (slightly more complicated, one comment can have multiple responses).
  • The way to achieve comments and reply to “building”, this is netease’s comments [specific can see the following blog, this is the most complex]

The blogger gave the relevant database design process, WHICH I found very good and benefited a lot

This blogger is commenting on the first situation:

Blog.csdn.net/yums467/art…

  • There are corresponding front-end style, database design, PHP background implementation

Here’s the github code and a summary of how the comments feature was designed:

Blog.csdn.net/muzili12a3/…

Set out to develop

Armed with the basics above, you’re ready to start developing your own comments feature. I’m just going to go with the simplest one, the one-watch design.

Combining the above knowledge, I designed a database table

It’s very simple, because my goal is to get people to leave comments on my site. If need be, do “building” or actually revert to that way later.

With the design of the database table, in fact, the Controller, Dao layer where the code is not difficult, the focus is on the page design……. (It’s still a little difficult for me)…

If you find this article helpful, give the author a little encouragement