Frank Vèssia Posted January 21, 2015 Posted January 21, 2015 (edited) Hi, I need to select pages with a specific selector, going back to parent and find values inside two pagefields.I can obtain pages with first pagefield like $pages->find("parent.pagefield.name=value"); but I need to go deeper with $pages->find("parent.pagefield.pagefield.id=value"); Any idea how to get this? -------------------------------------------- Solved in this easy way: $var = $pages->find("pagefield=value"); $pages->find("parent.pagefield=$var"); That's why I love PW Edited January 21, 2015 by Sevarf2
ESRCH Posted January 21, 2015 Posted January 21, 2015 Hi, Another way to do this is to use subselectors, which were introduced in Processwire 2.5. The code would then be: $pages->find("parent.id=[pagefield1.pagefield2.field=value]"); I love subselectors... 5
Frank Vèssia Posted January 21, 2015 Author Posted January 21, 2015 wow, i didn't know about this...thanks
ESRCH Posted January 21, 2015 Posted January 21, 2015 I would suggest reading this blog post, which lists all new stuff in Processwire 2.5. There are so many things, it's really impressive. I have actually bookmarked it due to all the really useful new functions. The subselectors are in the section "Selectors", which doesn't appear in the top navigation, but comes just after "Sanitizer" and just before "Session".
kongondo Posted January 21, 2015 Posted January 21, 2015 (edited) New additions arrived in April 2014 https://processwire.com/talk/topic/3768-processwire-dev-branch/?p=58722 (grouping) https://processwire.com/talk/topic/3768-processwire-dev-branch/?p=64049 (or-groups and sub-selectors) And are now documented here: http://processwire.com/api/selectors/ (but still missing grouping) OR-groups: matching one group of selectors or another Sub-selectors: selectors within selectors Edited January 21, 2015 by kongondo 1
Frank Vèssia Posted January 21, 2015 Author Posted January 21, 2015 after years working on PW it's always a bit difficult get in mind all the new stuff inside new versions, but it's a pleasure of course 1
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