dab Posted April 25, 2020 Share Posted April 25, 2020 Stumped with this....please can anyone help? I'm trying to find pages with a field that matches the search page's parent's title. This works $items = $pages->find('template=items-ordered,supplier=Acme Biscuits'); Not this...(did no find any pages). $items = $pages->find('template=items-ordered,supplier=$page->parent->title'); With thanks ? Link to comment Share on other sites More sharing options...
ottogal Posted April 25, 2020 Share Posted April 25, 2020 You could try $parent_title = $page->parent->title; $items = $pages->find('template=items-ordered,supplier=$parent_title'); Link to comment Share on other sites More sharing options...
kongondo Posted April 25, 2020 Share Posted April 25, 2020 You need double quotes. If you had debug on, this would have thrown an exception: 1 hour ago, dab said: $items = $pages->find('template=items-ordered,supplier=$page->parent->title'); Change it to this: $items = $pages->find("template=items-ordered,supplier={$page->parent->title}"); 1 Link to comment Share on other sites More sharing options...
dab Posted April 25, 2020 Author Share Posted April 25, 2020 Many thanks! Both worked. I had tried with {....} but obviously also needed the double quotes. I was outputting directly to .csv which was clearly not the best way to debug! Thanks again. 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