I've managed to disappear my content...

5 posts by 2 authors in: Forums > CMS Builder
Last Post: December 9, 2010   (RSS)

Re: [steve_e] I've managed to disappear my content...

By Jason - December 9, 2010

Hi Steve,

If you fill out a [url http://www.interactivetools.com/support/]2nd Level Support Request[/url] I can take a look at your code and see what's happening.

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] I've managed to disappear my content...

By steve_e - December 9, 2010

Thanks Jason - I've done that. Let me know if you need any further information.
Regards, Steve.

Re: [steve_e] I've managed to disappear my content...

By Jason - December 9, 2010

Hi Steve

I've tracked down this issue for you. What was happening is you added 2 special fields: removeDate and publishDate. When these are in a section they automatically become part of your sql query and will only return records with a removeDate <= current date AND records with publishDate >= current date. What happened here is you didn't filled out a value for these records so they get a default value of '0000-00-00 00:00:00', which will always fail this test. This is why you weren't getting any records.

What I did was change to query to do two things, first ignore the removeDate and publishDate fields and then manually add these rules to the where clause to allow for empty values. The queries look like this:
// load records
list($childdevRecords, $childdevMetaData) = getRecords(array(
'tableName' => 'childdev',
'orderBy' => 'created_date DESC',
'where' => "(removeDate>=NOW() OR removeDate='0000-00-00 00:00:00') AND (publishDate <=NOW() OR publishDate='0000-00-00 00:00:00')",
'ignoreRemoveDate' => true,
'ignorePublishDate' => true,
));

// load records
list($childdevRecords, $childdevMetaData) = getRecords(array(
'tableName' => 'childdev',
'where' => whereRecordNumberInUrl(1) ." AND (removeDate>=NOW() OR removeDate='0000-00-00 00:00:00') AND (publishDate <=NOW() OR publishDate='0000-00-00 00:00:00')",
'ignoreRemoveDate' => true,
'ignorePublishDate' => true,
'limit' => '1',
));

Hope this helps
Jason
---------------------------------------------------
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] I've managed to disappear my content...

By steve_e - December 9, 2010

Thanks a lot Jason. I appreciate the time taken to resolve the problem!
Regards, Steve