Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
Auto hiding a record after a certain number of days

 

 


NigelGordijk
User

Mar 12, 2010, 6:09 AM

Post #1 of 6 (1714 views)
Shortcut
Auto hiding a record after a certain number of days Can't Post

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


Dave
Staff / Moderator


Mar 12, 2010, 3:22 PM

Post #2 of 6 (1705 views)
Shortcut
Re: [NigelGordijk] Auto hiding a record after a certain number of days [In reply to] Can't Post

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
 


gkornbluth
Veteran

Mar 12, 2010, 3:55 PM

Post #3 of 6 (1702 views)
Shortcut
Re: [NigelGordijk] Auto hiding a record after a certain number of days [In reply to] Can't Post

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!
http://www.thecmsbcookbook.com


NigelGordijk
User

Mar 12, 2010, 4:10 PM

Post #4 of 6 (1695 views)
Shortcut
Re: [Dave] Auto hiding a record after a certain number of days [In reply to] Can't Post

Hi, Dave.

Will this delete the record, or merely hide it? I would prefer the latter, if possible.

Cheers,

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


Donna
Staff


Mar 12, 2010, 4:27 PM

Post #5 of 6 (1691 views)
Shortcut
Re: [NigelGordijk] Auto hiding a record after a certain number of days [In reply to] Can't Post

Hi Nigel,

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

Donna

--
support@interactivetools.com


NigelGordijk
User

Mar 13, 2010, 4:46 AM

Post #6 of 6 (1681 views)
Shortcut
Re: [Donna] Auto hiding a record after a certain number of days [In reply to] Can't Post

Thanks, Everyone!

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