bbb Posted June 30, 2017 Posted June 30, 2017 I have a template which makes use of the page reference field and am able to reference fields as so... $places = $wire->pages->find('template=pageGeo'); foreach($places as $place){ //geo_type is a page field getting pages I have stored in the admin folder //checking if the name of the page reference in this way works if($place->geo_type->name == 'geo-province') { echo 'this is a province'; } } I have another template that also makes use of the page reference field but this won't return anything except the page id //this doesn't return anything echo $page->party_type->title; seems the only way to get it to return the title is as follows: $id = $page->party_type; echo $pages->get('id='.$id)->title; //this returns "birthday" party_type also refers to pages that are found within the admin folder Both fields refer to pages I keep in the admin folder. So what am I missing?
Soma Posted June 30, 2017 Posted June 30, 2017 Maybe party_type is multiple instead of single page select? 4
arjen Posted July 1, 2017 Posted July 1, 2017 If you use Tracy you could also dump the object like: bd($page->party_type); It'll save you much time if you know what kind of data you are working on. 2
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