Listing Preview Page Issue

3 posts by 2 authors in: Forums > CMS Builder
Last Post: September 17, 2013   (RSS)

By mcelroyk - September 17, 2013

I added a preview page to the Viewer Urls => Preview Page Url field, and when creating a new entry, the preview works perfectly. However, when I click "Preview" while editing an existing entry, the preview page doesn't load any content from the CMS. The code I am using in my preview.php file to load entries is:

// load record from 'blog_entries'
list($blog_entriesRecords, $blog_entriesMetaData) = getRecords(array(
'tableName' => 'blog_entries',
'where' => whereRecordNumberInUrl(0),
'loadUploads' => true,
'allowSearch' => true,
'limit' => '1',
));
$blog_entriesRecord = @$blog_entriesRecords[0]; // get first record
if (!$blog_entriesRecord) { dieWith404("Record not found!"); } // show error message if no record found

The link being displayed in the address bar is preview.php?preview-9999999999, whether I am editing or creating an entry.

Thank you!

By mcelroyk - September 17, 2013

I identified the problem; I was filtering by record number in the PHP downpage as well as in my where statement.

Thanks for the help!