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 csdesign - June 3, 2013

oh, see (duh) I was trying to hide the detail page.  Makes perfect sense I have to hide it on the list page.  I will give that a try. Thanks!!!  Tina