jan Posted September 4, 2012 Share Posted September 4, 2012 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 More sharing options...
ryan Posted September 4, 2012 Share Posted September 4, 2012 Try this: $pages->find("articleImageFiles|articleImageLinks!=''"); Link to comment Share on other sites More sharing options...
jan Posted September 4, 2012 Author Share Posted September 4, 2012 Sorry, unfortunatelly this is not working. An article that has image links but no image files isn't found. This also does not work: $pages->find("articleImageFiles|articleImageLinks!="); Any other ideas? Link to comment Share on other sites More sharing options...
diogo Posted September 4, 2012 Share Posted September 4, 2012 what if you use repeaters for the links, instead of a text field? Then you can do this: $pages->find("articleImageFiles.count|articleImageLinks.count>0); Link to comment Share on other sites More sharing options...
jan Posted September 4, 2012 Author Share Posted September 4, 2012 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 More sharing options...
ryan Posted September 4, 2012 Share Posted September 4, 2012 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now