Jump to content

How to use checkbox value to output data?


photoman355
 Share

Recommended Posts

I have an area on my homepage that I want to print data based on a checkbox value in my site settings template.  When the box is checked I want to output some HTML.  I've tried various combinations of code but can't get it to work.  

Here's what I have at the moment.

<?php 

$settings = $pages->find("/site-settings/");

if ($settings->mycheckboxfield == 1) echo "<li>This</li>";
?>

Any ideas?

Link to comment
Share on other sites

I think it should be 

$settings = $pages->get("/site-settings/");

ie get [one page] rather than find [any number of pages]

(and you don't need the == 1 in the if because if $settings->mycheckboxfield is 1 then it will evaluate to true.)

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...