Jump to content

[Theory] Making a conditioned blog


abyssal

Recommended Posts

Hi guys. I wanted to make a blog but I'm really really stuck with an issue. I want to make a blog script (much like wordpress).

 

My SQL table has the columns: post_title (char), post_content (char) and post_comments_number (integer - gets the number of comments for each blog post).

 

Now I want to display the posts on two pages: posts with high number of comments (>30) and posts with low number of comments (<=30). I want to display the posts just like they are displayed on wordpress but the problem is I don't know how to do that, mostly when it comes to display the posts on multiple pages, 10 posts on each page.

 

Shortly: I want to display 10 posts with 30+ comments on the first page, the next 10 posts on the 2nd page and so on. How do I do that ? I think my logic fails because I don't know how to determine what was the latest post on the first page, so I can grab the next following posts on the following page.

 

Any help with that ?

Link to comment
https://forums.phpfreaks.com/topic/260396-theory-making-a-conditioned-blog/
Share on other sites

Breaking up content over pages is called "pagination", see here: http://www.phpfreaks.com/tutorial/basic-pagination

 

Do you really need a column to count the comments? That means that for every added or deleted comment you have to have an additional write. You could use a subquery to count how many comments for each post instead.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.