Auto hiding a record after a certain number of days

6 posts by 4 authors in: Forums > CMS Builder
Last Post: March 13, 2010   (RSS)

Hi, All.

Does anyone know if it's possible to hide an article after a certain number of days?

I built a CMSB-driven site for a client, which has a calendar of events: http://www.haroldalbrechtmp.ca/news-calendar.php. The client would like to set this up so an event that took place, say, more than seven days ago would automatically disappear from the index. At the moment, they're having to use the "Hide" function to manually remove an event.

Many thanks.
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net

Re: [NigelGordijk] Auto hiding a record after a certain number of days

By Dave - March 12, 2010

Hi Nigel,

Try adding a special "removeDate" field. See:
http://www.interactivetools.com/docs/cmsbuilder/special_fieldnames.html

Another way (using MySQL) would be to add this to the getRecords() options:
'where' => " `eventDate` >= (NOW() - INTERVAL 7 DAY) ",

If you try that be sure to change eventDate to match your fieldname.

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [NigelGordijk] Auto hiding a record after a certain number of days

Hi Nigel,

If the "7 days" is a constant you might have a look at this post for some ideas as well.

http://www.interactivetools.com/iforum/Products_C2/CMS_Builder_F35/displaying_tonights_performing_artist_P72298/

Best,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [NigelGordijk] Auto hiding a record after a certain number of days

By Donna - March 12, 2010

Hi Nigel,

It won't display in the front end. It will still exist in the back end, though. :)
Donna

--
support@interactivetools.com

Re: [Donna] Auto hiding a record after a certain number of days

Thanks, Everyone!
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net