Design of forum post pin function

Source: Internet
Author: User
Hi, all when I was doing a forum recommendation function recently, I don't know how to implement it. The requirement administrator can edit the post in the background. The post can be pushed to the homepage's recommendation position, which is the recommendation position of the Forum itself, there is also a global recommendation space (that is, the recommendation space of each forum should appear here... hi, all

I recently did not know how to implement the recommendation function of a forum.

  • Requirement

    • The administrator can edit the post in the background. The post can be pushed to the homepage's recommendation position, which is the recommendation position of the Forum itself, there is also a global recommendation space (that is, this post should appear in the recommendation space of each Forum ).
    • Recommended posts have multiple attribute categories, such as top posts and top posts.
  • Preliminary Implementation Scheme
    I used three tables (common_top_recommend) to allow the Administrator to edit them in the background. The fields are as follows:


-- Common_top_recommend table id -- auto-incrementing idpost_id -- Post idtop_recommned_position_id -- publish location id, associate it with another location table, such as the home page, Forum, Global type_id -- category id, associate another type table, for example, category_id -- Forum id -- common_top_recommend_position table id -- auto-increment idname -- display name codename -- name used for matching, such as index, category, global -- common_top_recommend_type table id -- auto-increment idname -- display name codename -- used for matching name, such as top/digest/announce

For example, find the top posts of a Forum:

select r.post_id from common_top_recommend as r left join common_top_recommend_position as p on r.top_recommned_position_id=p.id where r.category_id=1 or p.codename="global" ;

In this way, you can find the top posts of the current forum.

However, I think there may be some problems with this implementation. I have referred to the discuz and phpwind code. It seems that they all use the display_order field to complete location operations, but the specific implementation details are not very clear.

I wonder if there is any better and lighter solution?

Reply content:

Hi, all

I recently did not know how to implement the recommendation function of a forum.

  • Requirement

    • The administrator can edit the post in the background. The post can be pushed to the homepage's recommendation position, which is the recommendation position of the Forum itself, there is also a global recommendation space (that is, this post should appear in the recommendation space of each Forum ).
    • Recommended posts have multiple attribute categories, such as top posts and top posts.
  • Preliminary Implementation Scheme
    I used three tables (common_top_recommend) to allow the Administrator to edit them in the background. The fields are as follows:


-- Common_top_recommend table id -- auto-incrementing idpost_id -- Post idtop_recommned_position_id -- publish location id, associate it with another location table, such as the home page, Forum, Global type_id -- category id, associate another type table, for example, category_id -- Forum id -- common_top_recommend_position table id -- auto-increment idname -- display name codename -- name used for matching, such as index, category, global -- common_top_recommend_type table id -- auto-increment idname -- display name codename -- used for matching name, such as top/digest/announce

For example, find the top posts of a Forum:

select r.post_id from common_top_recommend as r left join common_top_recommend_position as p on r.top_recommned_position_id=p.id where r.category_id=1 or p.codename="global" ;

In this way, you can find the top posts of the current forum.

However, I think there may be some problems with this implementation. I have referred to the discuz and phpwind code. It seems that they all use the display_order field to complete location operations, but the specific implementation details are not very clear.

I wonder if there is any better and lighter solution?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.