How to Hide an Entry in a Multiple Record Listing

4 posts by 3 authors in: Forums > CMS Builder
Last Post: June 3, 2013   (RSS)

By csdesign - May 31, 2013

Hi!  

I have a multiple record lodge section. I would like to be able to "hide" a lodge detail page & on the list page via a radio button (or whatever else might work better).  This may or may not be the best way to accomplish it so I am completely open to using a better method!  For instance - only Active lodges will be shown on the site at any time but other lodges can be hidden for posting at a later date. 

LODGE STATUS (value): <?php echo $lodge_pagesRecord['lodge_status'] ?><br/>
LODGE STATUS (label): <?php echo $lodge_pagesRecord['lodge_status:label'] ?><br/>

Thanks! Tina

By gkornbluth - June 1, 2013

Hi Tina,

Would a Hidden" check box in the record work for you. (Added as a normal check box field but with Hidden as its name)

When the box is checked, the record is hidden from the site, but not erased.

If the status field is a check box, or has a value of "inactive" you might be able to use an if statement inside your list page foreach loop to exclude that record as well.

Something like:

 <?php foreach ($lodge_pageRecords as $record): ?>

<?php if (!$record['lodge_status'] == 1) :?>

code to show the lodge in the list page goes here

<?php endif ?>

<?php endforeach ?>

OR

 <?php foreach ($lodge_pageRecords as $record): ?>

<?php if (!$record['lodge_status'] == 'inactive') :?>

code to show the lodge in the list page goes here

<?php endif ?>

<?php endforeach ?>

The ! means 'not", and the == means 'exactly equal to'.

Hope that helps,

Jerry Kornbluth

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 ross99 - June 1, 2013

Hi there

I agree with Jerry that a "hidden" field should do the trick.  It also sounds like you might want certain lodges to be hidden auto hide after a certain date. If that's the case, you need a couple more special fields:

publishDate
removeDate
neverRemove

You can read up on how to set those kind of fields in our online docs:

http://www.interactivetools.com/docs/cmsbuilder/special_fieldnames.html

If you need a hand setting them up, let us know :).

Ross Fairbairn
http://www.interactivetools.com
consulting@interactivetools.com