dab Posted April 25, 2020 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 ?
ottogal Posted April 25, 2020 Posted April 25, 2020 You could try $parent_title = $page->parent->title; $items = $pages->find('template=items-ordered,supplier=$parent_title');
kongondo Posted April 25, 2020 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
dab Posted April 25, 2020 Author 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.
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