Jump to content
Sign in to follow this  
fruid

array of children where boolean is false

Recommended Posts

how do I return an array of children on which a certain boolean field is set to false?

$pages->get("fieldname=false");
$pages->find("fieldname=false");
$pages->child("fieldname=false");
$pages->children("fieldname=false");
$pages->fieldname(false);

please help me stop the guessing 😄

Share this post


Link to post
Share on other sites

Assuming you have a field called 'checkbox' of type Checkbox

// these two will return identical results
$found = $pages->find("checkbox=1");// find those whose values equal 1
// OR
$found2 = $pages->find("checkbox!=''");// find those that are not empty
// highly recommended; use Tracy :-)
bd($found,'found 1');
bd($found2,'found 2');

Boolean fields will be stored as true = 1. 

  • Like 1

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...