Display on website Check-Box

3 posts by 2 authors in: Forums > CMS Builder
Last Post: December 23, 2008   (RSS)

By avrom - December 23, 2008

Hi Dave,

I have the following code for displaying a multi-record section of comic books that is working fine.

There is also an additional field in the record which is a check box value "display_on_website". Obviously I want to add this into the code so if the record is checked "1" it displays, and if its unchecked "0" it doesn't display. Know that's an easy one too!!

Much thanx in advance, Avrom ;))


foreach ($comic_booksRecords as $record):
if ( is_int($record['num']/4) ) { echo '<div id="clearDiv"></div> '; } ?>
<div id="comics">
<?php
foreach ($record['comic_image'] as $upload):
if ($upload['isImage']): ?><img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" title="<?php echo $record['description'] ?>" alt="<?php echo $record['description'] ?>" />
<?php endif;
endforeach;
echo $record['content']; ?>
</div>
<?php endforeach; ?>

Re: [virgodesign] Display on website Check-Box

By Dave - December 23, 2008

Hi Avrom,

You could add that in the where options like this:
'where' => 'display_on_website = 1',

But even simpler is to just rename that field "hidden" (and toggle all the values). Hidden is special built in field that hides records from the viewers: http://www.interactivetools.com/docs/cmsbuilder/special_fieldnames.html

Either will work. Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Display on website Check-Box

By avrom - December 23, 2008

LOL That's the easy way to do it !! :)) Merry X-Mas Dave...