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 Jason - September 17, 2013

Hi,

I've done some testing with the code you provided as an example, and wasn't able to replicate this problem.  When you run this on an existing record, do you get a "Record not found" error?  Can you attach the preview.php file you are working with so we can take a closer look?

Thanks!

---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

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!