Jump to content

Combine selectors images.count>0 and textfield!=''


jan
 Share

Recommended Posts

Hi again,

I've got one more problem with selectors. I need get pages from page array that have images uploaded (fieldtype image) a OR (logical) imagelinks (fieldtype text) set.

Of course, it's no problem to get pages that have images uploaded AND imagelinks set:

$pages->find("articleImageFiles.count>0, articleImageLinks!=''");

What I need is a query to get pages that have images uploaded, or imagelinks set, or both. So a logic OR is needed.

Things like this unfoturnatelly didn't wok:

$pages->find("articleImageFiles.count>0|articleImageLinks!=''");

So does anyone know how to combine the selector elements with logical OR?

Thanks a lot to you all! Really a great community!!

Link to comment
Share on other sites

I'll keep this solution in mind. But a simple textfield with comma-seperated values acutally is "ok" for my needs :)

I'd have to change a couple of things if I use repaeter fields. So it would be nice, if theres another solution.

And perhaps if there's no solution, this issue is worth, thinking about new capibilities of processwire core?!

Thanks in advance!

Link to comment
Share on other sites

Sorry, unfortunatelly this is not working.

How about:

$pages->find("articleImageLinks|articleImageFiles!=, include=hidden"); 

I've not tried to combine these two different fieldtypes in an OR before, so if that doesn't work, Diogo's suggestion might be a good one, or you could always do this:

$pages->find("articleImageLinks!=")->add($pages->find("articleImageFiles.count>0")); 
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...