Show/hide some predefined text on Detailpage with checkbox

2 posts by 2 authors in: Forums > CMS Builder
Last Post: September 24, 2015   (RSS)

By kovali - September 23, 2015

Hi, I'm wondering how to do this:

On the product detailpage I want my client to have the option to show or hide some predefined text with a checkbox option in the CMS, in effect: the predefined text should be visible on the website when the checkbox in the CMS is checked...  and should disappear from the site when the checkbox in CMS is unchecked.

How can I achieve this pls ??

Thx in advance.

Koen

By Damon - September 24, 2015

Hi Koen,

Here are some steps to show/hide content based on a checkbox in CMS Builder:

  1. Add a checkbox in CMS Builder called "Show Featured Content" for example. Set the Default State radio button to Checked. And add text in the "Field Description" like this: Uncheck to hide Featured Content
  2. Generate to code for the checkbox and add it to your template along with the IF statement like this:

<?php if($record['show_featured_content'] == 1) : //if checkbox is checked then show the content ?>
   Predefined text here <br />
<?php endif; ?>

That should be it.  Try this out and let me know if you have any questions or issues.

Thanks!

Cheers,
Damon Edis - interactivetools.com

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