Jump to content

[SOLVED] postponed news articles


cindreta

Recommended Posts

Hi guys, i need you help...ok so i've made a small news article cms and now i would like to add the option when posting a new article where a user can select from 3 choiches:

1. active news - it will be posted and showed on the list of news

2. expired news- it willl be posted, but user can select a date when the article will exprie and untill then it will show on the list of news

3. postponed news - a user picks a date when to make a news active and only from that day on that news will be shown on the list of news

 

i know maybe its a lot, but i can't find the answers, i tryed googling and stuff but nothing solid, so if anybody has an idea, has experience with this, can help me.

thx

Link to comment
Share on other sites

The reason you haven't found anything on google is because this consists of several concepts.  I think I would have an effdate and termdate for each news article entry in the database so you can "select column, column from table where effdate <= now() and termdate > now()"

Link to comment
Share on other sites

I think R0bb0b answered your question pretty much but I'll fill in the gaps for you.

 

Typical table for news would include ID, DateSubmitted, Title, Text. To this you need to add StartDate, EndDate and Active.

 

To set news as always active you should just skip out adding values into the DB under StartDate and EndDate and just submit a 1 into Active.

 

To set news as delayed or only active within a certain timeframe you should set Active to 0 and then set your start/end date parameters.

 

When querying your database for news to display you should have a query that selects all news items with a StartDate > Now() and an EndDate < Now () OR Active =1, usually ordered by DateSubmitted. That way you will get all of the news items that are supposed to show between the dates you say, plus all of the news articles that are set to always show.

 

These querys wont be too hard to construct but I'll leave that to you as it always helps to expand your knowledge if you're forced to look and learn for yourself.

Link to comment
Share on other sites

GKWelding & R0bb0b thank you very much for the idea, no it won't be a problem to set thosse queryes at all...thank you very much for helping, if mods are reading you can make this into solved cos the answer is here....i just needed an idea of how to make it.

Thanks guys

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.