I've managed to disappear my content...

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

By steve_e - December 9, 2010

Hi -
I seem to have done something silly which shows up as my index and detail pages apparently not having any records. I did delete and re-create a custom schema preset around the same time, so not sure if this could have caused it (although I don't really understand how...).

If you look at this pagehttp://www.foundation-stage.info/articles/childdev_index.php it claims to have no records, although I can still see them both in CMS Builder and in the database. And this page: http://www.foundation-stage.info/articles/childdev/childdev.php?Child-initiated-Learning-1 until yesterday was the the url to one of them.

Any help gratefully received. [:)]

Regards, Steve

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: [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