Jump to content

Recommended Posts

Posted

hi, i came across something that is possibly a bug, (or maybe something I'm not understanding):

I have several /thing under /things, so like /things/things1. "Thing" contains a page field "tags". Tags is a list of checkboxes.

$pages->get('/things')->children('tags.name!=xx,limit=10')

My problem is that this query doesn't return the children with no (0) 'tags' checked (it's a page field, checkboxes, for tagging).  I'd like to create a query that returns all the pages that doesn't have the tag "xx", regardless if no tags or some tags have been selected.

thanks!

Posted

It's not a bug, but just how processwire does handle this kind of selector. If you need empty tags as well use the following:

$pages->find("parent=/things, (tags.name!=xx), (tags=''),limit=10")

 

  • Like 1
Posted

thank you!,

I realise things has improved with v.3. It seems I can also do:

$result = $pages->get('/all')->children('tags!=[name=xx],limit=10');

 

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
  • Recently Browsing   0 members

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