views:

85

answers:

2

I would like to set 5 new content items for monday through friday, but don't want to have to enable them each day.

Would it be best to set a timestamp in a mysql field, then something like this.

Set up a crontab with php that runs if timestamp is equal to today set "on" to 1.

What date/time format would be best, also if I put dates 05-20-09 would I be able to timestamp them and use a substring to convert them back and forth?

Thanks

+2  A: 

You could just have them all with "on" set to 1, and then within mysql query:

SELECT * FROM content WHERE publish_date < NOW();

That way you can still unpublish items, but they don't get displayed 'til after the date you specify.

phalacee
A: 

Use either the MySQL TIMESTAMP or DATETIME data type to store this data (the later of which is easily converted by MySQL to a timestamp if need be). Also, don't bother yourself with a crontab, just select content items by their publish date (much like WordPress does).

Justin Johnson
That was my reasoning too, only I got mine from Joomla :D
phalacee