Custom Preview Page - Need Way to Show Hidden and Date-unpubished Articles

5 posts by 3 authors in: Forums > CMS Builder
Last Post: July 31, 2013   (RSS)

Hi there,

Still fighting with the on-board preivew function and am about to declare defeat at it's hands. :) Have opted to build a custom preview page for one particular muti-record table on a project. However, to do this, I need to override the hidden value and the publishStart & publishEnd dates. Can anyone offer a quick way to approach this?

Many thanks,

J.

By gkornbluth - July 30, 2013

Hi J,

You may be able to use this approach in the load records call for the hidden check boxl.

 'where'    => " hidden = '0' ",
    'orWhere'    => " hidden = '1' ",

Have to think on the publish issue

Hope that helps,

jerry

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By gregThomas - July 31, 2013

Hi J,

If you're using a getRecords function to retrieve your data you can get it to override the hidden and display before/after dates with these variables:

  // load records from 'blog'
list($blogRecords, $blogMetaData) = getRecords(array(
  'tableName'         => 'blog',
  'loadUploads'       => true,
  'allowSearch'       => false,
  'ignoreHidden'      => true,  // don't hide records with hidden flag set
  'ignorePublishDate' => true,  // don't hide records with publishDate > now
  'ignoreRemoveDate'  => true,  // don't hide records with removeDate < now
));

So these array keys tell the getRecords function to ignore the hidden field, publish and remove dates.

Cheers!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

DING! We have a winner!

Thanks Greg. That's invaluable info for our needs.

Cheers,

J.