tooth-paste Posted July 2, 2018 Posted July 2, 2018 The output I get is an ID instead of a selected item. My page reference is located in my tree like this: Momenten (page reference) -Maandag -Dinsdag -Woensdag etc. This is my code. The field "dag" is the page reference but outputs ID's: $items = $page->children("sort=datum"); foreach ($items as $item) { echo ' <div class="col-md-12"> <audio controls preload="none"> <source src="' . $item->mp3->url .'" type="audio/mpeg"> <p>Audio is niet hoorbaar, HTML5 audio wordt door uw browser waarschijnlijk niet ondersteund.</p> </audio> </div> <div class="col-md-12"> <p><b>'. $item->predikant .'</b> op <b/>'. $item->datum .'</b> ('. $item->dag .')</p> </div>'; }
BFD Calendar Posted July 2, 2018 Posted July 2, 2018 My five cents for changing '$item->dag' into '$item->dag->title'. 1
tooth-paste Posted July 2, 2018 Author Posted July 2, 2018 That doesn't work:( 1 hour ago, BFD Calendar said: My five cents for changing '$item->dag' into '$item->dag->title'.
tooth-paste Posted July 2, 2018 Author Posted July 2, 2018 @BFD Calender: It works after I left out the "(" and ")". Thx!
dragan Posted July 2, 2018 Posted July 2, 2018 @tooth-paste Just a little tip: If you wrap your HTML and PHP in double quotes and use this syntax: {$item->mp3->url} you don't need to concatenate your string with 'foo ' . $var . ' bar' etc. 1
adrian Posted July 2, 2018 Posted July 2, 2018 5 hours ago, tooth-paste said: The output I get is an ID instead of a selected item Just to make things clear in case they aren't, you are getting the selected item - you're actually getting the full $page object for the item. The __toString() method is resulting in the ID of that being being output when you try to echo it as a string. You have to specify what field you want from the page, ->title, ->body, etc. 1 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