Jump to content

Best approach for maintaining millions of short news


vadimmil
 Share

Recommended Posts

Hi!

I'm currently developing a news site, which use 2 different content approaches. First: classic well-know long/short texts. Second and the tricky one: short news (twitter like style), 150-200 characters long, 120-150 of them will be published each day (yeah, I know, who really needs THIS NUMBER of news).

Now I'm thinking about a less messy way of handling all this short messages inside PW. Creating a page for each news item - not an option. I'm not sure why, but I feel sick thinking about maintaining millions of pages, each of which is used only for handling 2 sentences. 

What I'm thinking for now:

  • Create a page for each day.
  • Add Repeater Matrix for the template, and add news to this single page.
  • Use foreach construction to show this news on main page. 
  • On all news page create a calendar, showing news for each day.

Problems:

  • I'm not sure, how to handle date transform on main page. What I mean. Today, for example, is 8, August. So I'll show all news from the page, which was created on the 8, August. But, if it's 00:01 of the next day, news won't be showing. Off cause, I can make a simple check, if (there is no pages, created on this day) {show news from the previous one}. Not sure, that this is the best approach...
  • Not sure, how to add comments, if I would want to in future. Well, I'm quit sure, that the answer will be - no way. So, this approach will limit the possibilities of future development of this site.

May be someone can share his thoughts on how to make this in a more efficient way? 

Link to comment
Share on other sites

Just a couple of observations.

It really doesn't 'hurt' anything to have high numbers of pages - they are only database rows after all (slight oversimplification). It might feel wrong or clumsy coming from other CMSs, but PW is more flexible.

As far as a selector for recent news items, bear in mind that you can pass any string that can be parsed by strtotime() to a date selector so something like 

$latestNews = $pages->find("template=mini_news,created>='-18 hours'");

will return a pageArray of all items created in the last 18 hours, which you can manipulate further if necessary. The advantage of using a 'real' page for things like this is that you have all the flexibility that comes with that.

  • Like 4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...