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)
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.
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
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.
interactivetools.com
Re: [NigelGordijk] Auto hiding a record after a certain number of days
By gkornbluth - March 12, 2010
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
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Re: [Dave] Auto hiding a record after a certain number of days
Will this delete the record, or merely hide it? I would prefer the latter, if possible.
Cheers,
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 Donna - March 12, 2010
It won't display in the front end. It will still exist in the back end, though. :)
--
support@interactivetools.com
Re: [Donna] Auto hiding a record after a certain number of days
Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net