Jump to content

array of children where boolean is false


fruid
 Share

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 ?

Link to comment
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
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...