auto archiving news items
            4 posts by 2 authors in: Forums > CMS Builder
Last Post: October 8, 2010   (RSS)          
By paulmac - October 8, 2010
I have a latest news section that allows the user to specify a date that the news item should come off the system, I use removeDate to achieve this. Is there any way of displaying these records in an archive?
Thanks
Re: [paulmac] auto archiving news items
By Jason - October 8, 2010
Yes, you can still get these results by using the ignoreRemoveDate option in your getRecords function:
  list($newsRecords,$newsMetaData)=getRecords(array(
  'tableName'          =>  'news',
  'ignoreRemoveDate'   =>  true,
));This code will return ALL news records regardless of removeDate. If you want records created after a certain date, you'll have to add a "where" clause.
Hope this helps.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] auto archiving news items
By paulmac - October 8, 2010
To display only archived records (removedate is earlier than todays date) what should I specify in the where clause?
Thanks for your help.
Re: [paulmac] auto archiving news items
By Jason - October 8, 2010 - edited: October 8, 2010
If you want to get records that were created before today, you could try this:
<?php
  list($newsRecords,$newsMetaData)=getRecords(array(
     'tableName'  => 'news',
      'where'     => "createdDate < '".date("Y-m-d")."'",
      'ignoreRemoveDate' => true,
    ));
?>Hope this helps.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/